Set initial window event mask, don't set event variables we don't need

This commit is contained in:
Robert Ancell
2014-05-26 15:15:45 +02:00
parent eaff88f0ec
commit 5628a398ab
4 changed files with 9 additions and 16 deletions

View File

@@ -56,6 +56,6 @@ GdkDevice *_gdk_mir_device_new (GdkDeviceManager *device_manager, const gchar *n
GdkCursor *_gdk_mir_cursor_new (GdkDisplay *display, GdkCursorType type);
GdkWindowImpl *_gdk_mir_window_impl_new (int width, int height);
GdkWindowImpl *_gdk_mir_window_impl_new (int width, int height, GdkEventMask event_mask);
#endif /* __GDK_PRIVATE_MIR_H__ */

View File

@@ -191,6 +191,7 @@ static gboolean
gdk_mir_display_has_pending (GdkDisplay *display)
{
g_printerr ("gdk_mir_display_has_pending\n");
/* We don't need to poll for events - so nothing pending */
return FALSE;
}
@@ -198,6 +199,7 @@ static void
gdk_mir_display_queue_events (GdkDisplay *display)
{
g_printerr ("gdk_mir_display_queue_events\n");
/* We don't need to poll for events - so don't do anything*/
}
static void
@@ -217,6 +219,7 @@ static gboolean
gdk_mir_display_supports_shapes (GdkDisplay *display)
{
g_printerr ("gdk_mir_display_supports_shapes\n");
/* Mir doesn't support shaped windows */
return FALSE;
}
@@ -392,7 +395,7 @@ gdk_mir_display_create_window_impl (GdkDisplay *display,
gint attributes_mask)
{
g_printerr ("gdk_mir_display_create_window_impl (%d, %d, %d, %d)\n", window->x, window->y, window->width, window->height);
window->impl = _gdk_mir_window_impl_new (window->width, window->height);
window->impl = _gdk_mir_window_impl_new (window->width, window->height, event_mask);
}
static GdkKeymap *

View File

@@ -224,7 +224,7 @@ gdk_mir_screen_get_root_window (GdkScreen *screen)
get_screen_size (GDK_MIR_SCREEN (screen)->display_config, &width, &height);
s->root_window = _gdk_display_create_window (s->display);
s->root_window->impl = _gdk_mir_window_impl_new (width, height);
s->root_window->impl = _gdk_mir_window_impl_new (width, height, 0);
s->root_window->impl_window = s->root_window;
s->root_window->visual = s->visual;
s->root_window->window_type = GDK_WINDOW_ROOT;

View File

@@ -71,12 +71,13 @@ struct _GdkMirWindowImplClass
G_DEFINE_TYPE (GdkMirWindowImpl, gdk_mir_window_impl, GDK_TYPE_WINDOW_IMPL)
GdkWindowImpl *
_gdk_mir_window_impl_new (int width, int height)
_gdk_mir_window_impl_new (int width, int height, GdkEventMask event_mask)
{
GdkMirWindowImpl *impl = g_object_new (GDK_TYPE_MIR_WINDOW_IMPL, NULL);
impl->width = width;
impl->height = height;
impl->event_mask = event_mask;
return GDK_WINDOW_IMPL (impl);
}
@@ -397,7 +398,6 @@ generate_key_event (GdkWindow *window, GdkEventType type, guint state, guint key
GdkEvent *event;
event = gdk_event_new (type);
event->key.time = (guint32) (g_get_monotonic_time () / 1000);
event->key.state = state;
event->key.keyval = keyval;
event->key.length = 0;
@@ -409,19 +409,16 @@ generate_key_event (GdkWindow *window, GdkEventType type, guint state, guint key
send_event (window, _gdk_mir_device_manager_get_keyboard (gdk_display_get_device_manager (gdk_window_get_display (window))), event);
}
static void
void
generate_button_event (GdkWindow *window, GdkEventType type, gdouble x, gdouble y, guint button, guint state)
{
GdkEvent *event;
event = gdk_event_new (type);
event->button.time = (guint32) (g_get_monotonic_time () / 1000);
event->button.x = x;
event->button.y = y;
event->button.state = state;
event->button.button = button;
event->button.x_root = x; // FIXME
event->button.y_root = y; // FIXME
send_event (window, gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gdk_window_get_display (window))), event);
}
@@ -432,13 +429,10 @@ generate_scroll_event (GdkWindow *window, gdouble x, gdouble y, gdouble delta_x,
GdkEvent *event;
event = gdk_event_new (GDK_SCROLL);
event->scroll.time = (guint32) (g_get_monotonic_time () / 1000);
event->scroll.x = x;
event->scroll.y = y;
event->scroll.state = state;
event->scroll.direction = GDK_SCROLL_SMOOTH;
event->scroll.x_root = x; // FIXME
event->scroll.y_root = y; // FIXME
event->scroll.delta_x = delta_x;
event->scroll.delta_y = delta_y;
@@ -451,14 +445,10 @@ generate_motion_event (GdkWindow *window, gdouble x, gdouble y, guint state)
GdkEvent *event;
event = gdk_event_new (GDK_MOTION_NOTIFY);
event->motion.time = (guint32) (g_get_monotonic_time () / 1000);
event->motion.x = x;
event->motion.y = y;
event->motion.axes = NULL;
event->motion.state = state;
event->motion.is_hint = FALSE;
event->motion.x_root = x; // FIXME
event->motion.y_root = y; // FIXME
send_event (window, gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gdk_window_get_display (window))), event);
}