Commit 2f7af56d authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

server: Simplify the wineconsole event notification code.

parent 4fdcdefc
...@@ -231,12 +231,13 @@ static int console_input_events_signaled( struct object *obj, struct thread *thr ...@@ -231,12 +231,13 @@ static int console_input_events_signaled( struct object *obj, struct thread *thr
} }
/* add an event to the console's renderer events list */ /* add an event to the console's renderer events list */
static void console_input_events_append( struct console_input_events* evts, static void console_input_events_append( struct console_input* console,
struct console_renderer_event* evt) struct console_renderer_event* evt)
{ {
struct console_input_events* evts;
int collapsed = FALSE; int collapsed = FALSE;
if (!evts) return; if (!(evts = console->evt)) return;
/* to be done even when evt has been generated by the renderer ? */ /* to be done even when evt has been generated by the renderer ? */
/* try to collapse evt into current queue's events */ /* try to collapse evt into current queue's events */
...@@ -372,34 +373,34 @@ static void generate_sb_initial_events( struct console_input *console_input ) ...@@ -372,34 +373,34 @@ static void generate_sb_initial_events( struct console_input *console_input )
evt.event = CONSOLE_RENDERER_ACTIVE_SB_EVENT; evt.event = CONSOLE_RENDERER_ACTIVE_SB_EVENT;
memset(&evt.u, 0, sizeof(evt.u)); memset(&evt.u, 0, sizeof(evt.u));
console_input_events_append( console_input->evt, &evt ); console_input_events_append( console_input, &evt );
evt.event = CONSOLE_RENDERER_SB_RESIZE_EVENT; evt.event = CONSOLE_RENDERER_SB_RESIZE_EVENT;
evt.u.resize.width = screen_buffer->width; evt.u.resize.width = screen_buffer->width;
evt.u.resize.height = screen_buffer->height; evt.u.resize.height = screen_buffer->height;
console_input_events_append( console_input->evt, &evt ); console_input_events_append( console_input, &evt );
evt.event = CONSOLE_RENDERER_DISPLAY_EVENT; evt.event = CONSOLE_RENDERER_DISPLAY_EVENT;
evt.u.display.left = screen_buffer->win.left; evt.u.display.left = screen_buffer->win.left;
evt.u.display.top = screen_buffer->win.top; evt.u.display.top = screen_buffer->win.top;
evt.u.display.width = screen_buffer->win.right - screen_buffer->win.left + 1; evt.u.display.width = screen_buffer->win.right - screen_buffer->win.left + 1;
evt.u.display.height = screen_buffer->win.bottom - screen_buffer->win.top + 1; evt.u.display.height = screen_buffer->win.bottom - screen_buffer->win.top + 1;
console_input_events_append( console_input->evt, &evt ); console_input_events_append( console_input, &evt );
evt.event = CONSOLE_RENDERER_UPDATE_EVENT; evt.event = CONSOLE_RENDERER_UPDATE_EVENT;
evt.u.update.top = 0; evt.u.update.top = 0;
evt.u.update.bottom = screen_buffer->height - 1; evt.u.update.bottom = screen_buffer->height - 1;
console_input_events_append( console_input->evt, &evt ); console_input_events_append( console_input, &evt );
evt.event = CONSOLE_RENDERER_CURSOR_GEOM_EVENT; evt.event = CONSOLE_RENDERER_CURSOR_GEOM_EVENT;
evt.u.cursor_geom.size = screen_buffer->cursor_size; evt.u.cursor_geom.size = screen_buffer->cursor_size;
evt.u.cursor_geom.visible = screen_buffer->cursor_visible; evt.u.cursor_geom.visible = screen_buffer->cursor_visible;
console_input_events_append( console_input->evt, &evt ); console_input_events_append( console_input, &evt );
evt.event = CONSOLE_RENDERER_CURSOR_POS_EVENT; evt.event = CONSOLE_RENDERER_CURSOR_POS_EVENT;
evt.u.cursor_pos.x = screen_buffer->cursor_x; evt.u.cursor_pos.x = screen_buffer->cursor_x;
evt.u.cursor_pos.y = screen_buffer->cursor_y; evt.u.cursor_pos.y = screen_buffer->cursor_y;
console_input_events_append( console_input->evt, &evt ); console_input_events_append( console_input, &evt );
} }
static struct screen_buffer *create_console_output( struct console_input *console_input, int fd ) static struct screen_buffer *create_console_output( struct console_input *console_input, int fd )
...@@ -473,7 +474,7 @@ int free_console( struct process *process ) ...@@ -473,7 +474,7 @@ int free_console( struct process *process )
struct console_renderer_event evt; struct console_renderer_event evt;
evt.event = CONSOLE_RENDERER_EXIT_EVENT; evt.event = CONSOLE_RENDERER_EXIT_EVENT;
memset(&evt.u, 0, sizeof(evt.u)); memset(&evt.u, 0, sizeof(evt.u));
console_input_events_append( console->evt, &evt ); console_input_events_append( console, &evt );
} }
release_object( console ); release_object( console );
...@@ -764,7 +765,7 @@ static int set_console_input_info( const struct set_console_input_info_request * ...@@ -764,7 +765,7 @@ static int set_console_input_info( const struct set_console_input_info_request *
free( console->title ); free( console->title );
console->title = new_title; console->title = new_title;
evt.event = CONSOLE_RENDERER_TITLE_EVENT; evt.event = CONSOLE_RENDERER_TITLE_EVENT;
console_input_events_append( console->evt, &evt ); console_input_events_append( console, &evt );
} }
} }
if (req->mask & SET_CONSOLE_INPUT_INFO_HISTORY_MODE) if (req->mask & SET_CONSOLE_INPUT_INFO_HISTORY_MODE)
...@@ -898,7 +899,7 @@ static int set_console_output_info( struct screen_buffer *screen_buffer, ...@@ -898,7 +899,7 @@ static int set_console_output_info( struct screen_buffer *screen_buffer,
evt.event = CONSOLE_RENDERER_CURSOR_GEOM_EVENT; evt.event = CONSOLE_RENDERER_CURSOR_GEOM_EVENT;
evt.u.cursor_geom.size = req->cursor_size; evt.u.cursor_geom.size = req->cursor_size;
evt.u.cursor_geom.visible = req->cursor_visible; evt.u.cursor_geom.visible = req->cursor_visible;
console_input_events_append( screen_buffer->input->evt, &evt ); console_input_events_append( screen_buffer->input, &evt );
} }
} }
if (req->mask & SET_CONSOLE_OUTPUT_INFO_CURSOR_POS) if (req->mask & SET_CONSOLE_OUTPUT_INFO_CURSOR_POS)
...@@ -916,7 +917,7 @@ static int set_console_output_info( struct screen_buffer *screen_buffer, ...@@ -916,7 +917,7 @@ static int set_console_output_info( struct screen_buffer *screen_buffer,
evt.event = CONSOLE_RENDERER_CURSOR_POS_EVENT; evt.event = CONSOLE_RENDERER_CURSOR_POS_EVENT;
evt.u.cursor_pos.x = req->cursor_x; evt.u.cursor_pos.x = req->cursor_x;
evt.u.cursor_pos.y = req->cursor_y; evt.u.cursor_pos.y = req->cursor_y;
console_input_events_append( screen_buffer->input->evt, &evt ); console_input_events_append( screen_buffer->input, &evt );
} }
} }
if (req->mask & SET_CONSOLE_OUTPUT_INFO_SIZE) if (req->mask & SET_CONSOLE_OUTPUT_INFO_SIZE)
...@@ -936,12 +937,12 @@ static int set_console_output_info( struct screen_buffer *screen_buffer, ...@@ -936,12 +937,12 @@ static int set_console_output_info( struct screen_buffer *screen_buffer,
evt.event = CONSOLE_RENDERER_SB_RESIZE_EVENT; evt.event = CONSOLE_RENDERER_SB_RESIZE_EVENT;
evt.u.resize.width = req->width; evt.u.resize.width = req->width;
evt.u.resize.height = req->height; evt.u.resize.height = req->height;
console_input_events_append( screen_buffer->input->evt, &evt ); console_input_events_append( screen_buffer->input, &evt );
evt.event = CONSOLE_RENDERER_UPDATE_EVENT; evt.event = CONSOLE_RENDERER_UPDATE_EVENT;
evt.u.update.top = 0; evt.u.update.top = 0;
evt.u.update.bottom = screen_buffer->height - 1; evt.u.update.bottom = screen_buffer->height - 1;
console_input_events_append( screen_buffer->input->evt, &evt ); console_input_events_append( screen_buffer->input, &evt );
/* scroll window to display sb */ /* scroll window to display sb */
if (screen_buffer->win.right >= req->width) if (screen_buffer->win.right >= req->width)
...@@ -973,7 +974,7 @@ static int set_console_output_info( struct screen_buffer *screen_buffer, ...@@ -973,7 +974,7 @@ static int set_console_output_info( struct screen_buffer *screen_buffer,
evt.event = CONSOLE_RENDERER_CURSOR_POS_EVENT; evt.event = CONSOLE_RENDERER_CURSOR_POS_EVENT;
evt.u.cursor_pos.x = req->cursor_x; evt.u.cursor_pos.x = req->cursor_x;
evt.u.cursor_pos.y = req->cursor_y; evt.u.cursor_pos.y = req->cursor_y;
console_input_events_append( screen_buffer->input->evt, &evt ); console_input_events_append( screen_buffer->input, &evt );
} }
if (screen_buffer == screen_buffer->input->active && if (screen_buffer == screen_buffer->input->active &&
...@@ -1012,7 +1013,7 @@ static int set_console_output_info( struct screen_buffer *screen_buffer, ...@@ -1012,7 +1013,7 @@ static int set_console_output_info( struct screen_buffer *screen_buffer,
evt.u.display.top = req->win_top; evt.u.display.top = req->win_top;
evt.u.display.width = req->win_right - req->win_left + 1; evt.u.display.width = req->win_right - req->win_left + 1;
evt.u.display.height = req->win_bottom - req->win_top + 1; evt.u.display.height = req->win_bottom - req->win_top + 1;
console_input_events_append( screen_buffer->input->evt, &evt ); console_input_events_append( screen_buffer->input, &evt );
} }
} }
if (req->mask & SET_CONSOLE_OUTPUT_INFO_MAX_SIZE) if (req->mask & SET_CONSOLE_OUTPUT_INFO_MAX_SIZE)
...@@ -1229,7 +1230,7 @@ static int write_console_output( struct screen_buffer *screen_buffer, data_size_ ...@@ -1229,7 +1230,7 @@ static int write_console_output( struct screen_buffer *screen_buffer, data_size_
memset(&evt.u, 0, sizeof(evt.u)); memset(&evt.u, 0, sizeof(evt.u));
evt.u.update.top = y + x / screen_buffer->width; evt.u.update.top = y + x / screen_buffer->width;
evt.u.update.bottom = y + (x + i - 1) / screen_buffer->width; evt.u.update.bottom = y + (x + i - 1) / screen_buffer->width;
console_input_events_append( screen_buffer->input->evt, &evt ); console_input_events_append( screen_buffer->input, &evt );
} }
return i; return i;
} }
...@@ -1280,7 +1281,7 @@ static int fill_console_output( struct screen_buffer *screen_buffer, char_info_t ...@@ -1280,7 +1281,7 @@ static int fill_console_output( struct screen_buffer *screen_buffer, char_info_t
memset(&evt.u, 0, sizeof(evt.u)); memset(&evt.u, 0, sizeof(evt.u));
evt.u.update.top = y; evt.u.update.top = y;
evt.u.update.bottom = (y * screen_buffer->width + x + count - 1) / screen_buffer->width; evt.u.update.bottom = (y * screen_buffer->width + x + count - 1) / screen_buffer->width;
console_input_events_append( screen_buffer->input->evt, &evt ); console_input_events_append( screen_buffer->input, &evt );
} }
return i; return i;
} }
...@@ -1394,7 +1395,7 @@ static void scroll_console_output( obj_handle_t handle, int xsrc, int ysrc, int ...@@ -1394,7 +1395,7 @@ static void scroll_console_output( obj_handle_t handle, int xsrc, int ysrc, int
memset(&evt.u, 0, sizeof(evt.u)); memset(&evt.u, 0, sizeof(evt.u));
evt.u.update.top = min(ysrc, ydst); evt.u.update.top = min(ysrc, ydst);
evt.u.update.bottom = max(ysrc, ydst) + h - 1; evt.u.update.bottom = max(ysrc, ydst) + h - 1;
console_input_events_append( screen_buffer->input->evt, &evt ); console_input_events_append( screen_buffer->input, &evt );
release_object( screen_buffer ); release_object( screen_buffer );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment