[gtk+/wip/carlosg/event-as-object: 7/23] gdk: Remove GdkScreen from GdkEventPrivate
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/carlosg/event-as-object: 7/23] gdk: Remove GdkScreen from GdkEventPrivate
- Date: Tue, 31 Oct 2017 16:02:44 +0000 (UTC)
commit 933e8b33456c06db1524c0d8ab6a4d794334579a
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Oct 25 14:06:20 2017 +0200
gdk: Remove GdkScreen from GdkEventPrivate
Figure out the screen from the event window, there's presumably
just one GdkScreen anyway.
gdk/gdkevents.c | 35 -----------------------------------
gdk/gdkevents.h | 3 ---
gdk/gdkinternals.h | 1 -
gdk/wayland/gdkdevice-wayland.c | 16 ----------------
gdk/x11/gdkdevicemanager-core-x11.c | 31 ++++++-------------------------
gdk/x11/gdkdevicemanager-xi2.c | 23 ++---------------------
6 files changed, 8 insertions(+), 101 deletions(-)
---
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index a02a910..195be68 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -504,8 +504,6 @@ gdk_event_new (GdkEventType type)
event_hash = g_hash_table_new (g_direct_hash, NULL);
new_private = g_slice_new0 (GdkEventPrivate);
-
- new_private->screen = NULL;
g_hash_table_insert (event_hash, new_private, GUINT_TO_POINTER (1));
@@ -653,7 +651,6 @@ gdk_event_copy (const GdkEvent *event)
{
GdkEventPrivate *private = (GdkEventPrivate *)event;
- new_private->screen = private->screen;
g_set_object (&new_private->user_data, private->user_data);
}
@@ -1924,30 +1921,6 @@ gdk_events_get_center (GdkEvent *event1,
}
/**
- * gdk_event_set_screen:
- * @event: a #GdkEvent
- * @screen: a #GdkScreen
- *
- * Sets the screen for @event to @screen. The event must
- * have been allocated by GTK+, for instance, by
- * gdk_event_copy().
- *
- * Since: 2.2
- **/
-void
-gdk_event_set_screen (GdkEvent *event,
- GdkScreen *screen)
-{
- GdkEventPrivate *private;
-
- g_return_if_fail (gdk_event_is_allocated (event));
-
- private = (GdkEventPrivate *)event;
-
- private->screen = screen;
-}
-
-/**
* gdk_event_get_screen:
* @event: a #GdkEvent
*
@@ -1966,14 +1939,6 @@ gdk_event_set_screen (GdkEvent *event,
GdkScreen *
gdk_event_get_screen (const GdkEvent *event)
{
- if (gdk_event_is_allocated (event))
- {
- GdkEventPrivate *private = (GdkEventPrivate *)event;
-
- if (private->screen)
- return private->screen;
- }
-
if (event->any.window)
return gdk_window_get_screen (event->any.window);
diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h
index 448a542..014776d 100644
--- a/gdk/gdkevents.h
+++ b/gdk/gdkevents.h
@@ -668,9 +668,6 @@ void gdk_event_handler_set (GdkEventFunc func,
GDestroyNotify notify);
GDK_AVAILABLE_IN_ALL
-void gdk_event_set_screen (GdkEvent *event,
- GdkScreen *screen);
-GDK_AVAILABLE_IN_ALL
GdkScreen *gdk_event_get_screen (const GdkEvent *event);
GDK_AVAILABLE_IN_3_4
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 8c816a0..5c80a5d 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -143,7 +143,6 @@ typedef enum
struct _GdkEventPrivate
{
GdkEvent event;
- GdkScreen *screen;
GObject *user_data;
};
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 50c2f19..20a7073 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -1304,7 +1304,6 @@ create_scroll_event (GdkWaylandSeat *seat,
GdkDevice *source_device,
gboolean emulated)
{
- GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
GdkEvent *event;
event = gdk_event_new (GDK_SCROLL);
@@ -1313,7 +1312,6 @@ create_scroll_event (GdkWaylandSeat *seat,
gdk_event_set_source_device (event, source_device);
event->scroll.time = pointer_info->time;
event->scroll.state = device_get_modifiers (device);
- gdk_event_set_screen (event, display->screen);
gdk_event_set_pointer_emulated (event, emulated);
@@ -1573,7 +1571,6 @@ pointer_handle_motion (void *data,
event->motion.axes = NULL;
event->motion.state = device_get_modifiers (seat->master_pointer);
event->motion.is_hint = 0;
- gdk_event_set_screen (event, display->screen);
get_coordinates (seat->master_pointer,
&event->motion.x,
@@ -1640,7 +1637,6 @@ pointer_handle_button (void *data,
event->button.axes = NULL;
event->button.state = device_get_modifiers (seat->master_pointer);
event->button.button = gdk_button;
- gdk_event_set_screen (event, display->screen);
get_coordinates (seat->master_pointer,
&event->button.x,
@@ -2314,7 +2310,6 @@ _create_touch_event (GdkWaylandSeat *seat,
GdkEventType evtype,
uint32_t time)
{
- GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
gint x_root, y_root;
GdkEvent *event;
@@ -2324,7 +2319,6 @@ _create_touch_event (GdkWaylandSeat *seat,
gdk_event_set_source_device (event, seat->touch);
event->touch.time = time;
event->touch.state = device_get_modifiers (seat->touch_master);
- gdk_event_set_screen (event, display->screen);
event->touch.sequence = GDK_SLOT_TO_EVENT_SEQUENCE (touch->id);
if (touch->initial_touch)
@@ -2519,7 +2513,6 @@ emit_gesture_swipe_event (GdkWaylandSeat *seat,
gdouble dx,
gdouble dy)
{
- GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
GdkEvent *event;
if (!seat->pointer_info.focus)
@@ -2534,7 +2527,6 @@ emit_gesture_swipe_event (GdkWaylandSeat *seat,
gdk_event_set_source_device (event, seat->pointer);
event->touchpad_swipe.time = _time;
event->touchpad_swipe.state = device_get_modifiers (seat->master_pointer);
- gdk_event_set_screen (event, display->screen);
event->touchpad_swipe.dx = dx;
event->touchpad_swipe.dy = dy;
event->touchpad_swipe.n_fingers = n_fingers;
@@ -2621,7 +2613,6 @@ emit_gesture_pinch_event (GdkWaylandSeat *seat,
gdouble scale,
gdouble angle_delta)
{
- GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
GdkEvent *event;
if (!seat->pointer_info.focus)
@@ -2636,7 +2627,6 @@ emit_gesture_pinch_event (GdkWaylandSeat *seat,
gdk_event_set_source_device (event, seat->pointer);
event->touchpad_pinch.time = _time;
event->touchpad_pinch.state = device_get_modifiers (seat->master_pointer);
- gdk_event_set_screen (event, display->screen);
event->touchpad_pinch.dx = dx;
event->touchpad_pinch.dy = dy;
event->touchpad_pinch.scale = scale;
@@ -3634,8 +3624,6 @@ tablet_create_button_event_frame (GdkWaylandTabletData *tablet,
GdkEventType evtype,
guint button)
{
- GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tablet->seat);
- GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
GdkEvent *event;
event = gdk_wayland_tablet_get_frame_event (tablet, evtype);
@@ -3646,7 +3634,6 @@ tablet_create_button_event_frame (GdkWaylandTabletData *tablet,
event->button.time = tablet->pointer_info.time;
event->button.state = device_get_modifiers (tablet->master);
event->button.button = button;
- gdk_event_set_screen (event, display_wayland->screen);
get_coordinates (tablet->master,
&event->button.x,
@@ -3697,8 +3684,6 @@ tablet_tool_handle_motion (void *data,
{
GdkWaylandTabletToolData *tool = data;
GdkWaylandTabletData *tablet = tool->current_tablet;
- GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tool->seat);
- GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
GdkEvent *event;
tablet->pointer_info.surface_x = wl_fixed_to_double (sx);
@@ -3717,7 +3702,6 @@ tablet_tool_handle_motion (void *data,
event->motion.time = tablet->pointer_info.time;
event->motion.state = device_get_modifiers (tablet->master);
event->motion.is_hint = FALSE;
- gdk_event_set_screen (event, display->screen);
get_coordinates (tablet->master,
&event->motion.x,
diff --git a/gdk/x11/gdkdevicemanager-core-x11.c b/gdk/x11/gdkdevicemanager-core-x11.c
index 3bb7aad..67e9289 100644
--- a/gdk/x11/gdkdevicemanager-core-x11.c
+++ b/gdk/x11/gdkdevicemanager-core-x11.c
@@ -233,25 +233,6 @@ set_user_time (GdkWindow *window,
gdk_event_get_time (event));
}
-static gboolean
-set_screen_from_root (GdkDisplay *display,
- GdkEvent *event,
- Window xrootwin)
-{
- GdkScreen *screen;
-
- screen = _gdk_x11_display_screen_for_xrootwin (display, xrootwin);
-
- if (screen)
- {
- gdk_event_set_screen (event, screen);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
static GdkCrossingMode
translate_crossing_mode (int mode)
{
@@ -488,7 +469,7 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
event->scroll.delta_x = 0;
event->scroll.delta_y = 0;
- if (!set_screen_from_root (display, event, xevent->xbutton.root))
+ if (!_gdk_x11_display_screen_for_xrootwin (display, xevent->xbutton.root))
{
return_val = FALSE;
break;
@@ -509,7 +490,7 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
event->button.button = xevent->xbutton.button;
gdk_event_set_device (event, device_manager->core_pointer);
- if (!set_screen_from_root (display, event, xevent->xbutton.root))
+ if (!_gdk_x11_display_screen_for_xrootwin (display, xevent->xbutton.root))
return_val = FALSE;
break;
@@ -552,7 +533,7 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
event->button.button = xevent->xbutton.button;
gdk_event_set_device (event, device_manager->core_pointer);
- if (!set_screen_from_root (display, event, xevent->xbutton.root))
+ if (!_gdk_x11_display_screen_for_xrootwin (display, xevent->xbutton.root))
return_val = FALSE;
break;
@@ -582,7 +563,7 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
event->motion.is_hint = xevent->xmotion.is_hint;
gdk_event_set_device (event, device_manager->core_pointer);
- if (!set_screen_from_root (display, event, xevent->xbutton.root))
+ if (!_gdk_x11_display_screen_for_xrootwin (display, xevent->xbutton.root))
{
return_val = FALSE;
break;
@@ -603,7 +584,7 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
break;
}
- if (!set_screen_from_root (display, event, xevent->xbutton.root))
+ if (!_gdk_x11_display_screen_for_xrootwin (display, xevent->xbutton.root))
{
return_val = FALSE;
break;
@@ -647,7 +628,7 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
break;
}
- if (!set_screen_from_root (display, event, xevent->xbutton.root))
+ if (!_gdk_x11_display_screen_for_xrootwin (display, xevent->xbutton.root))
{
return_val = FALSE;
break;
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index 632065e..bc8ed9d 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -1093,25 +1093,6 @@ translate_notify_type (gint detail)
}
}
-static gboolean
-set_screen_from_root (GdkDisplay *display,
- GdkEvent *event,
- Window xrootwin)
-{
- GdkScreen *screen;
-
- screen = _gdk_x11_display_screen_for_xrootwin (display, xrootwin);
-
- if (screen)
- {
- gdk_event_set_screen (event, screen);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
static void
set_user_time (GdkEvent *event)
{
@@ -1621,7 +1602,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
if (return_val == FALSE)
break;
- if (!set_screen_from_root (display, event, xev->root))
+ if (!_gdk_x11_display_screen_for_xrootwin (display, xev->root))
{
return_val = FALSE;
break;
@@ -1782,7 +1763,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
if (return_val == FALSE)
break;
- if (!set_screen_from_root (display, event, xev->root))
+ if (!_gdk_x11_display_screen_for_xrootwin (display, xev->root))
{
return_val = FALSE;
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]