[gtk+] mir: fix build failure due to changed api
- From: William Hua <williamhua src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] mir: fix build failure due to changed api
- Date: Thu, 30 Apr 2015 16:44:29 +0000 (UTC)
commit ea190a339a9e61a52db9d307568f12e0a234f52b
Author: William Hua <william hua canonical com>
Date: Thu Apr 30 12:41:33 2015 -0400
mir: fix build failure due to changed api
gdk/mir/gdkmir-debug.c | 245 +++++++++++++------------------------------
gdk/mir/gdkmir-private.h | 8 +-
gdk/mir/gdkmireventsource.c | 184 ++++++++++++++++++++------------
gdk/mir/gdkmirwindowimpl.c | 12 ++-
4 files changed, 202 insertions(+), 247 deletions(-)
---
diff --git a/gdk/mir/gdkmir-debug.c b/gdk/mir/gdkmir-debug.c
index 4dd3ece..9bfdfe7 100644
--- a/gdk/mir/gdkmir-debug.c
+++ b/gdk/mir/gdkmir-debug.c
@@ -21,225 +21,132 @@ void
_gdk_mir_print_modifiers (unsigned int modifiers)
{
g_printerr (" Modifiers");
- if ((modifiers & mir_key_modifier_alt) != 0)
+ if ((modifiers & mir_input_event_modifier_alt) != 0)
g_printerr (" alt");
- if ((modifiers & mir_key_modifier_alt_left) != 0)
+ if ((modifiers & mir_input_event_modifier_alt_left) != 0)
g_printerr (" alt-left");
- if ((modifiers & mir_key_modifier_alt_right) != 0)
+ if ((modifiers & mir_input_event_modifier_alt_right) != 0)
g_printerr (" alt-right");
- if ((modifiers & mir_key_modifier_shift) != 0)
+ if ((modifiers & mir_input_event_modifier_shift) != 0)
g_printerr (" shift");
- if ((modifiers & mir_key_modifier_shift_left) != 0)
+ if ((modifiers & mir_input_event_modifier_shift_left) != 0)
g_printerr (" shift-left");
- if ((modifiers & mir_key_modifier_shift_right) != 0)
+ if ((modifiers & mir_input_event_modifier_shift_right) != 0)
g_printerr (" shift-right");
- if ((modifiers & mir_key_modifier_sym) != 0)
+ if ((modifiers & mir_input_event_modifier_sym) != 0)
g_printerr (" sym");
- if ((modifiers & mir_key_modifier_function) != 0)
+ if ((modifiers & mir_input_event_modifier_function) != 0)
g_printerr (" function");
- if ((modifiers & mir_key_modifier_ctrl) != 0)
+ if ((modifiers & mir_input_event_modifier_ctrl) != 0)
g_printerr (" ctrl");
- if ((modifiers & mir_key_modifier_ctrl_left) != 0)
+ if ((modifiers & mir_input_event_modifier_ctrl_left) != 0)
g_printerr (" ctrl-left");
- if ((modifiers & mir_key_modifier_ctrl_right) != 0)
+ if ((modifiers & mir_input_event_modifier_ctrl_right) != 0)
g_printerr (" ctrl-right");
- if ((modifiers & mir_key_modifier_meta) != 0)
+ if ((modifiers & mir_input_event_modifier_meta) != 0)
g_printerr (" meta");
- if ((modifiers & mir_key_modifier_meta_left) != 0)
+ if ((modifiers & mir_input_event_modifier_meta_left) != 0)
g_printerr (" meta-left");
- if ((modifiers & mir_key_modifier_meta_right) != 0)
+ if ((modifiers & mir_input_event_modifier_meta_right) != 0)
g_printerr (" meta-right");
- if ((modifiers & mir_key_modifier_caps_lock) != 0)
+ if ((modifiers & mir_input_event_modifier_caps_lock) != 0)
g_printerr (" caps-lock");
- if ((modifiers & mir_key_modifier_num_lock) != 0)
+ if ((modifiers & mir_input_event_modifier_num_lock) != 0)
g_printerr (" num-lock");
- if ((modifiers & mir_key_modifier_scroll_lock) != 0)
+ if ((modifiers & mir_input_event_modifier_scroll_lock) != 0)
g_printerr (" scroll-lock");
g_printerr ("\n");
}
void
-_gdk_mir_print_key_event (const MirKeyEvent *event)
+_gdk_mir_print_key_event (const MirInputEvent *event)
{
+ const MirKeyboardEvent *keyboard_event = mir_input_event_get_keyboard_event (event);
+
+ if (!keyboard_event)
+ return;
+
g_printerr ("KEY\n");
- g_printerr (" Device %i\n", event->device_id);
- g_printerr (" Source %i\n", event->source_id);
+ g_printerr (" Device %lld\n", (long long int) mir_input_event_get_device_id (event));
g_printerr (" Action ");
- switch (event->action)
+ switch (mir_keyboard_event_action (keyboard_event))
{
- case mir_key_action_down:
+ case mir_keyboard_action_down:
g_printerr ("down");
break;
- case mir_key_action_up:
+ case mir_keyboard_action_up:
g_printerr ("up");
break;
- case mir_key_action_multiple:
- g_printerr ("multiple");
+ case mir_keyboard_action_repeat:
+ g_printerr ("repeat");
break;
default:
- g_printerr ("%u", event->action);
+ g_printerr ("%u", mir_keyboard_event_action (keyboard_event));
break;
}
g_printerr ("\n");
- g_printerr (" Flags");
- if ((event->flags & mir_key_flag_woke_here) != 0)
- g_printerr (" woke-here");
- if ((event->flags & mir_key_flag_soft_keyboard) != 0)
- g_printerr (" soft-keyboard");
- if ((event->flags & mir_key_flag_keep_touch_mode) != 0)
- g_printerr (" keep-touch-mode");
- if ((event->flags & mir_key_flag_from_system) != 0)
- g_printerr (" from-system");
- if ((event->flags & mir_key_flag_editor_action) != 0)
- g_printerr (" editor-action");
- if ((event->flags & mir_key_flag_canceled) != 0)
- g_printerr (" canceled");
- if ((event->flags & mir_key_flag_virtual_hard_key) != 0)
- g_printerr (" virtual-hard-key");
- if ((event->flags & mir_key_flag_long_press) != 0)
- g_printerr (" long-press");
- if ((event->flags & mir_key_flag_canceled_long_press) != 0)
- g_printerr (" canceled-long-press");
- if ((event->flags & mir_key_flag_tracking) != 0)
- g_printerr (" tracking");
- if ((event->flags & mir_key_flag_fallback) != 0)
- g_printerr (" fallback");
- g_printerr ("\n");
- _gdk_mir_print_modifiers (event->modifiers);
- g_printerr (" Key Code %i\n", event->key_code);
- g_printerr (" Scan Code %i\n", event->scan_code);
- g_printerr (" Repeat Count %i\n", event->repeat_count);
- g_printerr (" Down Time %lli\n", (long long int) event->down_time);
- g_printerr (" Event Time %lli\n", (long long int) event->event_time);
- g_printerr (" Is System Key %s\n", event->is_system_key ? "true" : "false");
+ _gdk_mir_print_modifiers (mir_keyboard_event_modifiers (keyboard_event));
+ g_printerr (" Key Code %i\n", mir_keyboard_event_key_code (keyboard_event));
+ g_printerr (" Scan Code %i\n", mir_keyboard_event_scan_code (keyboard_event));
+ g_printerr (" Event Time %lli\n", (long long int) mir_input_event_get_event_time (event));
}
void
-_gdk_mir_print_motion_event (const MirMotionEvent *event)
+_gdk_mir_print_motion_event (const MirInputEvent *event)
{
- size_t i;
+ const MirPointerEvent *pointer_event = mir_input_event_get_pointer_event (event);
+
+ if (!pointer_event)
+ return;
g_printerr ("MOTION\n");
- g_printerr (" Device %i\n", event->device_id);
- g_printerr (" Source %i\n", event->source_id);
+ g_printerr (" Device %lld\n", (long long int) mir_input_event_get_device_id (event));
g_printerr (" Action ");
- switch (event->action)
+ switch (mir_pointer_event_action (pointer_event))
{
- case mir_motion_action_down:
+ case mir_pointer_action_button_down:
g_printerr ("down");
break;
- case mir_motion_action_up:
+ case mir_pointer_action_button_up:
g_printerr ("up");
break;
- case mir_motion_action_move:
- g_printerr ("move");
- break;
- case mir_motion_action_cancel:
- g_printerr ("cancel");
- break;
- case mir_motion_action_outside:
- g_printerr ("outside");
+ case mir_pointer_action_enter:
+ g_printerr ("enter");
break;
- case mir_motion_action_pointer_down:
- g_printerr ("pointer-down");
+ case mir_pointer_action_leave:
+ g_printerr ("leave");
break;
- case mir_motion_action_pointer_up:
- g_printerr ("pointer-up");
- break;
- case mir_motion_action_hover_move:
- g_printerr ("hover-move");
- break;
- case mir_motion_action_scroll:
- g_printerr ("scroll");
- break;
- case mir_motion_action_hover_enter:
- g_printerr ("hover-enter");
- break;
- case mir_motion_action_hover_exit:
- g_printerr ("hover-exit");
+ case mir_pointer_action_motion:
+ g_printerr ("motion");
break;
default:
- g_printerr ("%u", event->action);
+ g_printerr ("%u", mir_pointer_event_action (pointer_event));
}
g_printerr ("\n");
- g_printerr (" Flags");
- switch (event->flags)
- {
- case mir_motion_flag_window_is_obscured:
- g_printerr (" window-is-obscured");
- break;
- }
- g_printerr ("\n");
- _gdk_mir_print_modifiers (event->modifiers);
- g_printerr (" Edge Flags %i\n", event->edge_flags);
+ _gdk_mir_print_modifiers (mir_pointer_event_modifiers (pointer_event));
g_printerr (" Button State");
- switch (event->button_state)
- {
- case mir_motion_button_primary:
- g_printerr (" primary");
- break;
- case mir_motion_button_secondary:
- g_printerr (" secondary");
- break;
- case mir_motion_button_tertiary:
- g_printerr (" tertiary");
- break;
- case mir_motion_button_back:
- g_printerr (" back");
- break;
- case mir_motion_button_forward:
- g_printerr (" forward");
- break;
- }
+ if (mir_pointer_event_button_state (pointer_event, mir_pointer_button_primary))
+ g_printerr (" primary");
+ if (mir_pointer_event_button_state (pointer_event, mir_pointer_button_secondary))
+ g_printerr (" secondary");
+ if (mir_pointer_event_button_state (pointer_event, mir_pointer_button_tertiary))
+ g_printerr (" tertiary");
+ if (mir_pointer_event_button_state (pointer_event, mir_pointer_button_back))
+ g_printerr (" back");
+ if (mir_pointer_event_button_state (pointer_event, mir_pointer_button_forward))
+ g_printerr (" forward");
g_printerr ("\n");
- g_printerr (" Offset (%f, %f)\n", event->x_offset, event->y_offset);
- g_printerr (" Precision (%f, %f)\n", event->x_precision, event->y_precision);
- g_printerr (" Down Time %lli\n", (long long int) event->down_time);
- g_printerr (" Event Time %lli\n", (long long int) event->event_time);
- g_printerr (" Pointer Coordinates\n");
- for (i = 0; i < event->pointer_count; i++)
- {
- g_printerr (" ID=%i location=(%f, %f) raw=(%f, %f) touch=(%f, %f) size=%f pressure=%f orientation=%f
scroll=(%f, %f) tool=",
- event->pointer_coordinates[i].id,
- event->pointer_coordinates[i].x, event->pointer_coordinates[i].y,
- event->pointer_coordinates[i].raw_x, event->pointer_coordinates[i].raw_y,
- event->pointer_coordinates[i].touch_major, event->pointer_coordinates[i].touch_minor,
- event->pointer_coordinates[i].size,
- event->pointer_coordinates[i].pressure,
- event->pointer_coordinates[i].orientation,
- event->pointer_coordinates[i].hscroll, event->pointer_coordinates[i].vscroll);
- switch (event->pointer_coordinates[i].tool_type)
- {
- case mir_motion_tool_type_unknown:
- g_printerr ("unknown");
- break;
- case mir_motion_tool_type_finger:
- g_printerr ("finger");
- break;
- case mir_motion_tool_type_stylus:
- g_printerr ("stylus");
- break;
- case mir_motion_tool_type_mouse:
- g_printerr ("mouse");
- break;
- case mir_motion_tool_type_eraser:
- g_printerr ("eraser");
- break;
- default:
- g_printerr ("%u", event->pointer_coordinates[i].tool_type);
- break;
- }
- g_printerr ("\n");
- }
+ g_printerr (" Offset (%f, %f)\n", mir_pointer_event_axis_value (pointer_event, mir_pointer_axis_x),
+ mir_pointer_event_axis_value (pointer_event, mir_pointer_axis_y));
+ g_printerr (" Event Time %lli\n", (long long int) mir_input_event_get_event_time (event));
}
void
_gdk_mir_print_surface_event (const MirSurfaceEvent *event)
{
g_printerr ("SURFACE\n");
- g_printerr (" Surface %i\n", event->id);
g_printerr (" Attribute ");
- switch (event->attrib)
+ switch (mir_surface_event_get_attribute (event))
{
case mir_surface_attrib_type:
g_printerr ("type");
@@ -254,50 +161,48 @@ _gdk_mir_print_surface_event (const MirSurfaceEvent *event)
g_printerr ("focus");
break;
default:
- g_printerr ("%u", event->attrib);
+ g_printerr ("%u", mir_surface_event_get_attribute (event));
break;
}
g_printerr ("\n");
- g_printerr (" Value %i\n", event->value);
+ g_printerr (" Value %i\n", mir_surface_event_get_attribute_value (event));
}
void
_gdk_mir_print_resize_event (const MirResizeEvent *event)
{
g_printerr ("RESIZE\n");
- g_printerr (" Surface %i\n", event->surface_id);
- g_printerr (" Size (%i, %i)\n", event->width, event->height);
+ g_printerr (" Size (%i, %i)\n", mir_resize_event_get_width (event), mir_resize_event_get_height (event));
}
void
_gdk_mir_print_close_event (const MirCloseSurfaceEvent *event)
{
g_printerr ("CLOSED\n");
- g_printerr (" Surface %i\n", event->surface_id);
}
void
_gdk_mir_print_event (const MirEvent *event)
{
- switch (event->type)
+ switch (mir_event_get_type (event))
{
case mir_event_type_key:
- _gdk_mir_print_key_event (&event->key);
+ _gdk_mir_print_key_event (mir_event_get_input_event (event));
break;
case mir_event_type_motion:
- _gdk_mir_print_motion_event (&event->motion);
+ _gdk_mir_print_motion_event (mir_event_get_input_event (event));
break;
case mir_event_type_surface:
- _gdk_mir_print_surface_event (&event->surface);
+ _gdk_mir_print_surface_event (mir_event_get_surface_event (event));
break;
case mir_event_type_resize:
- _gdk_mir_print_resize_event (&event->resize);
+ _gdk_mir_print_resize_event (mir_event_get_resize_event (event));
break;
case mir_event_type_close_surface:
- _gdk_mir_print_close_event (&event->close_surface);
+ _gdk_mir_print_close_event (mir_event_get_close_surface_event (event));
break;
default:
- g_printerr ("EVENT %u\n", event->type);
+ g_printerr ("EVENT %u\n", mir_event_get_type (event));
break;
}
}
diff --git a/gdk/mir/gdkmir-private.h b/gdk/mir/gdkmir-private.h
index 6f0b6c3..847720b 100644
--- a/gdk/mir/gdkmir-private.h
+++ b/gdk/mir/gdkmir-private.h
@@ -89,9 +89,9 @@ void _gdk_mir_window_impl_set_surface_state (GdkMirWindowImpl *impl, MirSurfaceS
void _gdk_mir_window_impl_set_surface_type (GdkMirWindowImpl *impl, MirSurfaceType type);
-void _gdk_mir_window_impl_set_cursor_state (GdkMirWindowImpl *impl, gdouble x, gdouble y, gboolean
cursor_inside, MirMotionButton button_state);
+void _gdk_mir_window_impl_set_cursor_state (GdkMirWindowImpl *impl, gdouble x, gdouble y, gboolean
cursor_inside, guint button_state);
-void _gdk_mir_window_impl_get_cursor_state (GdkMirWindowImpl *impl, gdouble *x, gdouble *y, gboolean
*cursor_inside, MirMotionButton *button_state);
+void _gdk_mir_window_impl_get_cursor_state (GdkMirWindowImpl *impl, gdouble *x, gdouble *y, gboolean
*cursor_inside, guint *button_state);
GdkMirEventSource *_gdk_mir_display_get_event_source (GdkDisplay *display);
@@ -123,9 +123,9 @@ EGLSurface _gdk_mir_window_get_dummy_egl_surface (GdkWindow *window, EGLConfig c
void _gdk_mir_print_modifiers (unsigned int modifiers);
-void _gdk_mir_print_key_event (const MirKeyEvent *event);
+void _gdk_mir_print_key_event (const MirInputEvent *event);
-void _gdk_mir_print_motion_event (const MirMotionEvent *event);
+void _gdk_mir_print_motion_event (const MirInputEvent *event);
void _gdk_mir_print_surface_event (const MirSurfaceEvent *event);
diff --git a/gdk/mir/gdkmireventsource.c b/gdk/mir/gdkmireventsource.c
index b908366..cb1db64 100644
--- a/gdk/mir/gdkmireventsource.c
+++ b/gdk/mir/gdkmireventsource.c
@@ -32,7 +32,7 @@ struct _GdkMirWindowReference {
typedef struct {
GdkMirWindowReference *window_ref;
- MirEvent event;
+ const MirEvent *event;
} GdkMirQueuedEvent;
struct _GdkMirEventSource
@@ -240,50 +240,66 @@ get_modifier_state (unsigned int modifiers, unsigned int button_state)
{
guint modifier_state = 0;
- if ((modifiers & mir_key_modifier_alt) != 0)
+ if ((modifiers & (mir_input_event_modifier_alt |
+ mir_input_event_modifier_alt_left |
+ mir_input_event_modifier_alt_right)) != 0)
modifier_state |= GDK_MOD1_MASK;
- if ((modifiers & mir_key_modifier_shift) != 0)
+ if ((modifiers & (mir_input_event_modifier_shift |
+ mir_input_event_modifier_shift_left |
+ mir_input_event_modifier_shift_right)) != 0)
modifier_state |= GDK_SHIFT_MASK;
- if ((modifiers & mir_key_modifier_ctrl) != 0)
+ if ((modifiers & (mir_input_event_modifier_ctrl |
+ mir_input_event_modifier_ctrl_left |
+ mir_input_event_modifier_ctrl_right)) != 0)
modifier_state |= GDK_CONTROL_MASK;
- if ((modifiers & mir_key_modifier_meta) != 0)
- modifier_state |= GDK_SUPER_MASK;
- if ((modifiers & mir_key_modifier_caps_lock) != 0)
+ if ((modifiers & (mir_input_event_modifier_meta |
+ mir_input_event_modifier_meta_left |
+ mir_input_event_modifier_meta_right)) != 0)
+ modifier_state |= GDK_META_MASK;
+ if ((modifiers & mir_input_event_modifier_caps_lock) != 0)
modifier_state |= GDK_LOCK_MASK;
- if ((button_state & mir_motion_button_primary) != 0)
+ if ((button_state & mir_pointer_button_primary) != 0)
modifier_state |= GDK_BUTTON1_MASK;
- if ((button_state & mir_motion_button_secondary) != 0)
- modifier_state |= GDK_BUTTON3_MASK;
- if ((button_state & mir_motion_button_tertiary) != 0)
+ if ((button_state & mir_pointer_button_secondary) != 0)
modifier_state |= GDK_BUTTON2_MASK;
+ if ((button_state & mir_pointer_button_tertiary) != 0)
+ modifier_state |= GDK_BUTTON3_MASK;
+ if ((button_state & mir_pointer_button_back) != 0)
+ modifier_state |= GDK_BUTTON4_MASK;
+ if ((button_state & mir_pointer_button_forward) != 0)
+ modifier_state |= GDK_BUTTON5_MASK;
return modifier_state;
}
static void
-handle_key_event (GdkWindow *window, const MirKeyEvent *event)
+handle_key_event (GdkWindow *window, const MirInputEvent *event)
{
+ const MirKeyboardEvent *keyboard_event = mir_input_event_get_keyboard_event (event);
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
GdkKeymap *keymap;
guint modifier_state;
- MirMotionButton button_state;
+ guint button_state;
- switch (event->action)
+ if (!keyboard_event)
+ return;
+
+ switch (mir_keyboard_event_action (keyboard_event))
{
- case mir_key_action_down:
- case mir_key_action_up:
+ case mir_keyboard_action_up:
+ case mir_keyboard_action_down:
// FIXME: Convert keycode
_gdk_mir_window_impl_get_cursor_state (impl, NULL, NULL, NULL, &button_state);
- modifier_state = get_modifier_state (event->modifiers, button_state);
+ modifier_state = get_modifier_state (mir_keyboard_event_modifiers (keyboard_event), button_state);
keymap = gdk_keymap_get_for_display (gdk_window_get_display (window));
generate_key_event (window,
- event->action == mir_key_action_down ? GDK_KEY_PRESS : GDK_KEY_RELEASE,
+ mir_keyboard_event_action (keyboard_event) == mir_keyboard_action_down ?
GDK_KEY_PRESS : GDK_KEY_RELEASE,
modifier_state,
- event->key_code,
- event->scan_code,
- _gdk_mir_keymap_key_is_modifier (keymap, event->key_code),
- NANO_TO_MILLI (event->event_time));
+ mir_keyboard_event_key_code (keyboard_event),
+ mir_keyboard_event_scan_code (keyboard_event),
+ _gdk_mir_keymap_key_is_modifier (keymap, mir_keyboard_event_key_code
(keyboard_event)),
+ NANO_TO_MILLI (mir_input_event_get_event_time (event)));
break;
default:
//case mir_key_action_multiple:
@@ -322,7 +338,7 @@ leave_windows_except (GdkWindow *window,
{
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
gboolean cursor_inside;
- MirMotionButton button_state;
+ guint button_state;
_gdk_mir_window_impl_get_cursor_state (impl, NULL, NULL, &cursor_inside, &button_state);
@@ -333,29 +349,47 @@ leave_windows_except (GdkWindow *window,
}
}
+static guint
+mir_pointer_event_get_button_state (const MirPointerEvent *event)
+{
+ guint button_state = 0;
+
+ if (mir_pointer_event_button_state (event, mir_pointer_button_primary))
+ button_state |= mir_pointer_button_primary;
+ if (mir_pointer_event_button_state (event, mir_pointer_button_secondary))
+ button_state |= mir_pointer_button_secondary;
+ if (mir_pointer_event_button_state (event, mir_pointer_button_tertiary))
+ button_state |= mir_pointer_button_tertiary;
+ if (mir_pointer_event_button_state (event, mir_pointer_button_back))
+ button_state |= mir_pointer_button_back;
+ if (mir_pointer_event_button_state (event, mir_pointer_button_forward))
+ button_state |= mir_pointer_button_forward;
+
+ return button_state;
+}
+
static void
-handle_motion_event (GdkWindow *window, const MirMotionEvent *event)
+handle_motion_event (GdkWindow *window, const MirInputEvent *event)
{
+ const MirPointerEvent *pointer_event = mir_input_event_get_pointer_event (event);
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
gdouble x, y;
gboolean cursor_inside;
- MirMotionButton button_state;
+ guint button_state;
guint modifier_state;
guint32 event_time;
GdkEventType event_type;
- MirMotionButton changed_button_state;
+ guint changed_button_state;
+
+ if (!pointer_event)
+ return;
_gdk_mir_window_impl_get_cursor_state (impl, &x, &y, &cursor_inside, &button_state);
- if (event->pointer_count > 0)
- {
- x = event->pointer_coordinates[0].x;
- y = event->pointer_coordinates[0].y;
- }
- modifier_state = get_modifier_state (event->modifiers, event->button_state);
- event_time = NANO_TO_MILLI (event->event_time);
+ modifier_state = get_modifier_state (mir_pointer_event_modifiers (pointer_event),
mir_pointer_event_get_button_state (pointer_event));
+ event_time = NANO_TO_MILLI (mir_input_event_get_event_time (event));
/* TODO: Remove once we have proper transient window support. */
- if (event->action == mir_motion_action_hover_exit)
+ if (mir_pointer_event_action (pointer_event) == mir_pointer_action_leave)
{
LeaveInfo info;
@@ -392,43 +426,55 @@ handle_motion_event (GdkWindow *window, const MirMotionEvent *event)
if (!cursor_inside_pointer_window)
{
generate_crossing_event (window, GDK_ENTER_NOTIFY, x, y, event_time);
- _gdk_mir_window_impl_set_cursor_state (impl, x, y, TRUE, event->button_state);
+ _gdk_mir_window_impl_set_cursor_state (impl, x, y, TRUE, mir_pointer_event_get_button_state
(pointer_event));
}
}
}
if (window)
{
+ gdouble new_x;
+ gdouble new_y;
+ gdouble hscroll;
+ gdouble vscroll;
+
/* Update which window has focus */
_gdk_mir_pointer_set_location (get_pointer (window), x, y, window, modifier_state);
- switch (event->action)
+ switch (mir_pointer_event_action (pointer_event))
{
- case mir_motion_action_down:
- case mir_motion_action_up:
- event_type = event->action == mir_motion_action_down ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE;
- changed_button_state = button_state ^ event->button_state;
- if (changed_button_state == 0 || (changed_button_state & mir_motion_button_primary) != 0)
+ case mir_pointer_action_button_up:
+ case mir_pointer_action_button_down:
+ event_type = mir_pointer_event_action (pointer_event) == mir_pointer_action_button_down ?
GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE;
+ changed_button_state = button_state ^ mir_pointer_event_get_button_state (pointer_event);
+ if (changed_button_state == 0 || (changed_button_state & mir_pointer_button_primary) != 0)
generate_button_event (window, event_type, x, y, GDK_BUTTON_PRIMARY, modifier_state, event_time);
- if ((changed_button_state & mir_motion_button_secondary) != 0)
+ if ((changed_button_state & mir_pointer_button_secondary) != 0)
generate_button_event (window, event_type, x, y, GDK_BUTTON_SECONDARY, modifier_state,
event_time);
- if ((changed_button_state & mir_motion_button_tertiary) != 0)
+ if ((changed_button_state & mir_pointer_button_tertiary) != 0)
generate_button_event (window, event_type, x, y, GDK_BUTTON_MIDDLE, modifier_state, event_time);
- button_state = event->button_state;
- break;
- case mir_motion_action_scroll:
- generate_scroll_event (window, x, y, event->pointer_coordinates[0].hscroll,
event->pointer_coordinates[0].vscroll, modifier_state, event_time);
+ button_state = mir_pointer_event_get_button_state (pointer_event);
break;
- case mir_motion_action_move: // move with button
- case mir_motion_action_hover_move: // move without button
- generate_motion_event (window, x, y, modifier_state, event_time);
+ case mir_pointer_action_motion:
+ new_x = mir_pointer_event_axis_value (pointer_event, mir_pointer_axis_x);
+ new_y = mir_pointer_event_axis_value (pointer_event, mir_pointer_axis_y);
+ hscroll = mir_pointer_event_axis_value (pointer_event, mir_pointer_axis_hscroll);
+ vscroll = mir_pointer_event_axis_value (pointer_event, mir_pointer_axis_vscroll);
+
+ if (hscroll > 0.5 || vscroll > 0.5)
+ generate_scroll_event (window, x, y, hscroll, vscroll, modifier_state, event_time);
+ if (ABS (new_x - x) > 0.5 || ABS (new_y - y) > 0.5)
+ generate_motion_event (window, new_x, new_y, modifier_state, event_time);
+
break;
- case mir_motion_action_hover_exit:
+ case mir_pointer_action_leave:
if (cursor_inside)
{
cursor_inside = FALSE;
generate_crossing_event (window, GDK_LEAVE_NOTIFY, x, y, event_time);
}
break;
+ default:
+ break;
}
_gdk_mir_window_impl_set_cursor_state (impl, x, y, cursor_inside, button_state);
@@ -440,19 +486,19 @@ handle_surface_event (GdkWindow *window, const MirSurfaceEvent *event)
{
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
- switch (event->attrib)
+ switch (mir_surface_event_get_attribute (event))
{
case mir_surface_attrib_type:
- _gdk_mir_window_impl_set_surface_type (impl, event->value);
+ _gdk_mir_window_impl_set_surface_type (impl, mir_surface_event_get_attribute_value (event));
break;
case mir_surface_attrib_state:
- _gdk_mir_window_impl_set_surface_state (impl, event->value);
+ _gdk_mir_window_impl_set_surface_state (impl, mir_surface_event_get_attribute_value (event));
// FIXME: notify
break;
case mir_surface_attrib_swapinterval:
break;
case mir_surface_attrib_focus:
- generate_focus_event (window, event->value != 0);
+ generate_focus_event (window, mir_surface_event_get_attribute_value (event) != 0);
break;
default:
break;
@@ -478,11 +524,11 @@ static void
handle_resize_event (GdkWindow *window,
const MirResizeEvent *event)
{
- window->width = event->width;
- window->height = event->height;
+ window->width = mir_resize_event_get_width (event);
+ window->height = mir_resize_event_get_height (event);
_gdk_window_update_size (window);
- generate_configure_event (window, event->width, event->height);
+ generate_configure_event (window, mir_resize_event_get_width (event), mir_resize_event_get_height (event));
}
static void
@@ -496,7 +542,7 @@ handle_close_event (GdkWindow *window,
typedef struct
{
GdkWindow *window;
- MirEvent event;
+ MirEvent *event;
} EventData;
static void
@@ -505,19 +551,19 @@ gdk_mir_event_source_queue_event (GdkDisplay *display,
const MirEvent *event)
{
// FIXME: Only generate events if the window wanted them?
- switch (event->type)
+ switch (mir_event_get_type (event))
{
case mir_event_type_key:
- handle_key_event (window, &event->key);
+ handle_key_event (window, mir_event_get_input_event (event));
break;
case mir_event_type_motion:
- handle_motion_event (window, &event->motion);
+ handle_motion_event (window, mir_event_get_input_event (event));
break;
case mir_event_type_surface:
- handle_surface_event (window, &event->surface);
+ handle_surface_event (window, mir_event_get_surface_event (event));
break;
case mir_event_type_resize:
- handle_resize_event (window, &event->resize);
+ handle_resize_event (window, mir_event_get_resize_event (event));
break;
case mir_event_type_prompt_session_state_change:
// FIXME?
@@ -526,10 +572,10 @@ gdk_mir_event_source_queue_event (GdkDisplay *display,
// FIXME?
break;
case mir_event_type_close_surface:
- handle_close_event (window, &event->close_surface);
+ handle_close_event (window, mir_event_get_close_surface_event (event));
break;
default:
- g_warning ("Ignoring unknown Mir event %d", event->type);
+ g_warning ("Ignoring unknown Mir event %d", mir_event_get_type (event));
// FIXME?
break;
}
@@ -569,9 +615,9 @@ gdk_mir_event_source_convert_events (GdkMirEventSource *source)
if (window != NULL)
{
if (source->log_events)
- _gdk_mir_print_event (&event->event);
+ _gdk_mir_print_event (event->event);
- gdk_mir_event_source_queue_event (source->display, window, &event->event);
+ gdk_mir_event_source_queue_event (source->display, window, event->event);
}
else
g_warning ("window was destroyed before event arrived...");
@@ -735,7 +781,7 @@ _gdk_mir_event_source_queue (GdkMirWindowReference *window_ref,
queued_event = g_slice_new (GdkMirQueuedEvent);
g_atomic_int_inc (&window_ref->ref_count);
queued_event->window_ref = window_ref;
- queued_event->event = *event;
+ queued_event->event = event;
g_mutex_lock (&source->mir_event_lock);
g_queue_push_tail (&source->mir_events, queued_event);
diff --git a/gdk/mir/gdkmirwindowimpl.c b/gdk/mir/gdkmirwindowimpl.c
index b4767cb..9cafcc9 100644
--- a/gdk/mir/gdkmirwindowimpl.c
+++ b/gdk/mir/gdkmirwindowimpl.c
@@ -59,7 +59,7 @@ struct _GdkMirWindowImpl
/* Current button state for checking which buttons are being pressed / released */
gdouble x;
gdouble y;
- MirMotionButton button_state;
+ guint button_state;
/* Surface being rendered to (only exists when window visible) */
MirSurface *surface;
@@ -113,7 +113,7 @@ _gdk_mir_window_impl_set_cursor_state (GdkMirWindowImpl *impl,
gdouble x,
gdouble y,
gboolean cursor_inside,
- MirMotionButton button_state)
+ guint button_state)
{
impl->x = x;
impl->y = y;
@@ -126,7 +126,7 @@ _gdk_mir_window_impl_get_cursor_state (GdkMirWindowImpl *impl,
gdouble *x,
gdouble *y,
gboolean *cursor_inside,
- MirMotionButton *button_state)
+ guint *button_state)
{
if (x)
*x = impl->x;
@@ -227,15 +227,19 @@ ensure_surface_full (GdkWindow *window,
window->width, window->height,
buffer_usage);
- MirEvent resize_event;
+ /* FIXME: can't make an initial resize event */
+ // MirEvent *resize_event;
/* Send the initial configure with the size the server gave... */
+ /* FIXME: can't make an initial resize event */
+ /*
resize_event.resize.type = mir_event_type_resize;
resize_event.resize.surface_id = 0;
resize_event.resize.width = window->width;
resize_event.resize.height = window->height;
_gdk_mir_event_source_queue (window_ref, &resize_event);
+ */
mir_surface_set_event_handler (impl->surface, event_cb, window_ref); // FIXME: Ignore some events until
shown
set_surface_type (impl, impl->surface_type);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]