[gtk+/wip/mir3.12: 4/46] Set initial window event mask, don't set event variables we don't need



commit 5628a398ab7231f47ffe7c953a44ec1e607c9cd4
Author: Robert Ancell <robert ancell canonical com>
Date:   Mon May 26 15:15:45 2014 +0200

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

 gdk/mir/gdkmir-private.h   |    2 +-
 gdk/mir/gdkmirdisplay.c    |    5 ++++-
 gdk/mir/gdkmirscreen.c     |    2 +-
 gdk/mir/gdkmirwindowimpl.c |   16 +++-------------
 4 files changed, 9 insertions(+), 16 deletions(-)
---
diff --git a/gdk/mir/gdkmir-private.h b/gdk/mir/gdkmir-private.h
index 744f5a9..c49cf90 100644
--- a/gdk/mir/gdkmir-private.h
+++ b/gdk/mir/gdkmir-private.h
@@ -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__ */
diff --git a/gdk/mir/gdkmirdisplay.c b/gdk/mir/gdkmirdisplay.c
index 7d606fe..8ca31cd 100644
--- a/gdk/mir/gdkmirdisplay.c
+++ b/gdk/mir/gdkmirdisplay.c
@@ -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 *
diff --git a/gdk/mir/gdkmirscreen.c b/gdk/mir/gdkmirscreen.c
index fc6cd65..1077271 100644
--- a/gdk/mir/gdkmirscreen.c
+++ b/gdk/mir/gdkmirscreen.c
@@ -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;
diff --git a/gdk/mir/gdkmirwindowimpl.c b/gdk/mir/gdkmirwindowimpl.c
index 14b710b..80c1dd3 100644
--- a/gdk/mir/gdkmirwindowimpl.c
+++ b/gdk/mir/gdkmirwindowimpl.c
@@ -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);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]