wayland: Clean up naming of GdkWaylandDisplay pointers
The naming of pointers to GdkWaylandDisplay's were inconsistent. Running the following commands in gtk+/gdk/wayland illustrate the inconsistency: $ grep -r '\<display_wayland\>' *.[ch] | wc -l 195 $ grep -r '\<wayland_display\>' *.[ch] | wc -l 81 This patch renames all occurrences of "wayland_display" to "display_wayland". This is also consistent with naming in the X11 backend. A couple of whitespace changes were done as well in places where the rename was already done, that added line breaks to long lines that stood out. https://bugzilla.gnome.org/show_bug.cgi?id=765474
This commit is contained in:
committed by
Matthias Clasen
parent
7700243bd4
commit
cb73becfb4
@ -139,7 +139,7 @@ name_fallback (const gchar *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
_gdk_wayland_cursor_update (GdkWaylandDisplay *wayland_display,
|
_gdk_wayland_cursor_update (GdkWaylandDisplay *display_wayland,
|
||||||
GdkWaylandCursor *cursor)
|
GdkWaylandCursor *cursor)
|
||||||
{
|
{
|
||||||
struct wl_cursor *c;
|
struct wl_cursor *c;
|
||||||
@ -149,7 +149,7 @@ _gdk_wayland_cursor_update (GdkWaylandDisplay *wayland_display,
|
|||||||
if (cursor->name == NULL)
|
if (cursor->name == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
theme = _gdk_wayland_display_get_scaled_cursor_theme (wayland_display,
|
theme = _gdk_wayland_display_get_scaled_cursor_theme (display_wayland,
|
||||||
cursor->scale);
|
cursor->scale);
|
||||||
c = wl_cursor_theme_get_cursor (theme, cursor->name);
|
c = wl_cursor_theme_get_cursor (theme, cursor->name);
|
||||||
if (!c)
|
if (!c)
|
||||||
@ -293,7 +293,7 @@ void
|
|||||||
_gdk_wayland_cursor_set_scale (GdkCursor *cursor,
|
_gdk_wayland_cursor_set_scale (GdkCursor *cursor,
|
||||||
guint scale)
|
guint scale)
|
||||||
{
|
{
|
||||||
GdkWaylandDisplay *wayland_display =
|
GdkWaylandDisplay *display_wayland =
|
||||||
GDK_WAYLAND_DISPLAY (gdk_cursor_get_display (cursor));
|
GDK_WAYLAND_DISPLAY (gdk_cursor_get_display (cursor));
|
||||||
GdkWaylandCursor *wayland_cursor = GDK_WAYLAND_CURSOR (cursor);
|
GdkWaylandCursor *wayland_cursor = GDK_WAYLAND_CURSOR (cursor);
|
||||||
|
|
||||||
@ -308,7 +308,7 @@ _gdk_wayland_cursor_set_scale (GdkCursor *cursor,
|
|||||||
|
|
||||||
wayland_cursor->scale = scale;
|
wayland_cursor->scale = scale;
|
||||||
|
|
||||||
_gdk_wayland_cursor_update (wayland_display, wayland_cursor);
|
_gdk_wayland_cursor_update (display_wayland, wayland_cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -333,11 +333,11 @@ _gdk_wayland_display_get_cursor_for_name_with_scale (GdkDisplay *display,
|
|||||||
guint scale)
|
guint scale)
|
||||||
{
|
{
|
||||||
GdkWaylandCursor *private;
|
GdkWaylandCursor *private;
|
||||||
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (display);
|
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||||
|
|
||||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
||||||
|
|
||||||
private = g_hash_table_lookup (wayland_display->cursor_cache, name);
|
private = g_hash_table_lookup (display_wayland->cursor_cache, name);
|
||||||
if (private)
|
if (private)
|
||||||
return GDK_CURSOR (g_object_ref (private));
|
return GDK_CURSOR (g_object_ref (private));
|
||||||
|
|
||||||
@ -352,11 +352,13 @@ _gdk_wayland_display_get_cursor_for_name_with_scale (GdkDisplay *display,
|
|||||||
if (!name || g_str_equal (name, "none") || g_str_equal (name, "blank_cursor"))
|
if (!name || g_str_equal (name, "none") || g_str_equal (name, "blank_cursor"))
|
||||||
return GDK_CURSOR (private);
|
return GDK_CURSOR (private);
|
||||||
|
|
||||||
if (!_gdk_wayland_cursor_update (wayland_display, private))
|
if (!_gdk_wayland_cursor_update (display_wayland, private))
|
||||||
return GDK_CURSOR (private);
|
return GDK_CURSOR (private);
|
||||||
|
|
||||||
/* Insert into cache. */
|
/* Insert into cache. */
|
||||||
g_hash_table_insert (wayland_display->cursor_cache, private->name, g_object_ref (private));
|
g_hash_table_insert (display_wayland->cursor_cache,
|
||||||
|
private->name,
|
||||||
|
g_object_ref (private));
|
||||||
return GDK_CURSOR (private);
|
return GDK_CURSOR (private);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,13 +423,13 @@ _gdk_wayland_display_get_cursor_for_surface (GdkDisplay *display,
|
|||||||
gdouble y)
|
gdouble y)
|
||||||
{
|
{
|
||||||
GdkWaylandCursor *cursor;
|
GdkWaylandCursor *cursor;
|
||||||
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (display);
|
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||||
struct wl_buffer *buffer;
|
struct wl_buffer *buffer;
|
||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
|
|
||||||
cursor = g_object_new (GDK_TYPE_WAYLAND_CURSOR,
|
cursor = g_object_new (GDK_TYPE_WAYLAND_CURSOR,
|
||||||
"cursor-type", GDK_CURSOR_IS_PIXMAP,
|
"cursor-type", GDK_CURSOR_IS_PIXMAP,
|
||||||
"display", wayland_display,
|
"display", display_wayland,
|
||||||
NULL);
|
NULL);
|
||||||
cursor->name = NULL;
|
cursor->name = NULL;
|
||||||
cursor->surface.hotspot_x = x;
|
cursor->surface.hotspot_x = x;
|
||||||
@ -449,10 +451,11 @@ _gdk_wayland_display_get_cursor_for_surface (GdkDisplay *display,
|
|||||||
cursor->surface.height = 1;
|
cursor->surface.height = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor->surface.cairo_surface = _gdk_wayland_display_create_shm_surface (wayland_display,
|
cursor->surface.cairo_surface =
|
||||||
cursor->surface.width,
|
_gdk_wayland_display_create_shm_surface (display_wayland,
|
||||||
cursor->surface.height,
|
cursor->surface.width,
|
||||||
cursor->surface.scale);
|
cursor->surface.height,
|
||||||
|
cursor->surface.scale);
|
||||||
|
|
||||||
buffer = _gdk_wayland_shm_surface_get_wl_buffer (cursor->surface.cairo_surface);
|
buffer = _gdk_wayland_shm_surface_get_wl_buffer (cursor->surface.cairo_surface);
|
||||||
wl_buffer_add_listener (buffer, &buffer_listener, cursor->surface.cairo_surface);
|
wl_buffer_add_listener (buffer, &buffer_listener, cursor->surface.cairo_surface);
|
||||||
|
|||||||
@ -1205,7 +1205,7 @@ pointer_handle_enter (void *data,
|
|||||||
{
|
{
|
||||||
GdkWaylandSeat *seat = data;
|
GdkWaylandSeat *seat = data;
|
||||||
GdkEvent *event;
|
GdkEvent *event;
|
||||||
GdkWaylandDisplay *wayland_display =
|
GdkWaylandDisplay *display_wayland =
|
||||||
GDK_WAYLAND_DISPLAY (seat->display);
|
GDK_WAYLAND_DISPLAY (seat->display);
|
||||||
|
|
||||||
if (!surface)
|
if (!surface)
|
||||||
@ -1214,7 +1214,7 @@ pointer_handle_enter (void *data,
|
|||||||
if (!GDK_IS_WINDOW (wl_surface_get_user_data (surface)))
|
if (!GDK_IS_WINDOW (wl_surface_get_user_data (surface)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_gdk_wayland_display_update_serial (wayland_display, serial);
|
_gdk_wayland_display_update_serial (display_wayland, serial);
|
||||||
|
|
||||||
seat->pointer_info.focus = wl_surface_get_user_data(surface);
|
seat->pointer_info.focus = wl_surface_get_user_data(surface);
|
||||||
g_object_ref(seat->pointer_info.focus);
|
g_object_ref(seat->pointer_info.focus);
|
||||||
@ -1249,7 +1249,7 @@ pointer_handle_enter (void *data,
|
|||||||
g_message ("enter, seat %p surface %p",
|
g_message ("enter, seat %p surface %p",
|
||||||
seat, seat->pointer_info.focus));
|
seat, seat->pointer_info.focus));
|
||||||
|
|
||||||
if (wayland_display->seat_version < WL_POINTER_HAS_FRAME)
|
if (display_wayland->seat_version < WL_POINTER_HAS_FRAME)
|
||||||
gdk_wayland_seat_flush_frame_event (seat);
|
gdk_wayland_seat_flush_frame_event (seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1261,7 +1261,7 @@ pointer_handle_leave (void *data,
|
|||||||
{
|
{
|
||||||
GdkWaylandSeat *seat = data;
|
GdkWaylandSeat *seat = data;
|
||||||
GdkEvent *event;
|
GdkEvent *event;
|
||||||
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (seat->display);
|
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
|
||||||
|
|
||||||
if (!surface)
|
if (!surface)
|
||||||
return;
|
return;
|
||||||
@ -1272,7 +1272,7 @@ pointer_handle_leave (void *data,
|
|||||||
if (!seat->pointer_info.focus)
|
if (!seat->pointer_info.focus)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_gdk_wayland_display_update_serial (wayland_display, serial);
|
_gdk_wayland_display_update_serial (display_wayland, serial);
|
||||||
|
|
||||||
event = gdk_wayland_seat_get_frame_event (seat, GDK_LEAVE_NOTIFY);
|
event = gdk_wayland_seat_get_frame_event (seat, GDK_LEAVE_NOTIFY);
|
||||||
event->crossing.window = g_object_ref (seat->pointer_info.focus);
|
event->crossing.window = g_object_ref (seat->pointer_info.focus);
|
||||||
@ -1305,7 +1305,7 @@ pointer_handle_leave (void *data,
|
|||||||
|
|
||||||
seat->pointer_info.focus = NULL;
|
seat->pointer_info.focus = NULL;
|
||||||
|
|
||||||
if (wayland_display->seat_version < WL_POINTER_HAS_FRAME)
|
if (display_wayland->seat_version < WL_POINTER_HAS_FRAME)
|
||||||
gdk_wayland_seat_flush_frame_event (seat);
|
gdk_wayland_seat_flush_frame_event (seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2653,7 +2653,7 @@ seat_handle_capabilities (void *data,
|
|||||||
{
|
{
|
||||||
GdkWaylandSeat *seat = data;
|
GdkWaylandSeat *seat = data;
|
||||||
GdkWaylandDeviceManager *device_manager = GDK_WAYLAND_DEVICE_MANAGER (seat->device_manager);
|
GdkWaylandDeviceManager *device_manager = GDK_WAYLAND_DEVICE_MANAGER (seat->device_manager);
|
||||||
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (seat->display);
|
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
|
||||||
|
|
||||||
GDK_NOTE (MISC,
|
GDK_NOTE (MISC,
|
||||||
g_message ("seat %p with %s%s%s", wl_seat,
|
g_message ("seat %p with %s%s%s", wl_seat,
|
||||||
@ -2682,10 +2682,10 @@ seat_handle_capabilities (void *data,
|
|||||||
device_manager->devices =
|
device_manager->devices =
|
||||||
g_list_prepend (device_manager->devices, seat->pointer);
|
g_list_prepend (device_manager->devices, seat->pointer);
|
||||||
|
|
||||||
if (wayland_display->pointer_gestures)
|
if (display_wayland->pointer_gestures)
|
||||||
{
|
{
|
||||||
seat->wp_pointer_gesture_swipe =
|
seat->wp_pointer_gesture_swipe =
|
||||||
zwp_pointer_gestures_v1_get_swipe_gesture (wayland_display->pointer_gestures,
|
zwp_pointer_gestures_v1_get_swipe_gesture (display_wayland->pointer_gestures,
|
||||||
seat->wl_pointer);
|
seat->wl_pointer);
|
||||||
zwp_pointer_gesture_swipe_v1_set_user_data (seat->wp_pointer_gesture_swipe,
|
zwp_pointer_gesture_swipe_v1_set_user_data (seat->wp_pointer_gesture_swipe,
|
||||||
seat);
|
seat);
|
||||||
@ -2693,7 +2693,7 @@ seat_handle_capabilities (void *data,
|
|||||||
&gesture_swipe_listener, seat);
|
&gesture_swipe_listener, seat);
|
||||||
|
|
||||||
seat->wp_pointer_gesture_pinch =
|
seat->wp_pointer_gesture_pinch =
|
||||||
zwp_pointer_gestures_v1_get_pinch_gesture (wayland_display->pointer_gestures,
|
zwp_pointer_gestures_v1_get_pinch_gesture (display_wayland->pointer_gestures,
|
||||||
seat->wl_pointer);
|
seat->wl_pointer);
|
||||||
zwp_pointer_gesture_pinch_v1_set_user_data (seat->wp_pointer_gesture_pinch,
|
zwp_pointer_gesture_pinch_v1_set_user_data (seat->wp_pointer_gesture_pinch,
|
||||||
seat);
|
seat);
|
||||||
@ -3096,7 +3096,7 @@ tablet_tool_handle_proximity_in (void *data,
|
|||||||
GdkWaylandTabletToolData *tool = data;
|
GdkWaylandTabletToolData *tool = data;
|
||||||
GdkWaylandTabletData *tablet = zwp_tablet_v1_get_user_data (wp_tablet);
|
GdkWaylandTabletData *tablet = zwp_tablet_v1_get_user_data (wp_tablet);
|
||||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tablet->seat);
|
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tablet->seat);
|
||||||
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (seat->display);
|
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
|
||||||
GdkWindow *window = wl_surface_get_user_data (surface);
|
GdkWindow *window = wl_surface_get_user_data (surface);
|
||||||
GdkEvent *event;
|
GdkEvent *event;
|
||||||
|
|
||||||
@ -3108,7 +3108,7 @@ tablet_tool_handle_proximity_in (void *data,
|
|||||||
tool->current_tablet = tablet;
|
tool->current_tablet = tablet;
|
||||||
tablet->current_tool = tool;
|
tablet->current_tool = tool;
|
||||||
|
|
||||||
_gdk_wayland_display_update_serial (wayland_display, serial);
|
_gdk_wayland_display_update_serial (display_wayland, serial);
|
||||||
tablet->pointer_info.enter_serial = serial;
|
tablet->pointer_info.enter_serial = serial;
|
||||||
|
|
||||||
tablet->pointer_info.focus = g_object_ref (window);
|
tablet->pointer_info.focus = g_object_ref (window);
|
||||||
@ -3165,7 +3165,7 @@ tablet_create_button_event_frame (GdkWaylandTabletData *tablet,
|
|||||||
guint button)
|
guint button)
|
||||||
{
|
{
|
||||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tablet->seat);
|
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tablet->seat);
|
||||||
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (seat->display);
|
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
|
||||||
GdkEvent *event;
|
GdkEvent *event;
|
||||||
|
|
||||||
event = gdk_wayland_tablet_get_frame_event (tablet, evtype);
|
event = gdk_wayland_tablet_get_frame_event (tablet, evtype);
|
||||||
@ -3176,7 +3176,7 @@ tablet_create_button_event_frame (GdkWaylandTabletData *tablet,
|
|||||||
event->button.time = tablet->pointer_info.time;
|
event->button.time = tablet->pointer_info.time;
|
||||||
event->button.state = device_get_modifiers (tablet->master);
|
event->button.state = device_get_modifiers (tablet->master);
|
||||||
event->button.button = button;
|
event->button.button = button;
|
||||||
gdk_event_set_screen (event, wayland_display->screen);
|
gdk_event_set_screen (event, display_wayland->screen);
|
||||||
|
|
||||||
get_coordinates (tablet->master,
|
get_coordinates (tablet->master,
|
||||||
&event->button.x,
|
&event->button.x,
|
||||||
@ -3193,12 +3193,12 @@ tablet_tool_handle_down (void *data,
|
|||||||
GdkWaylandTabletToolData *tool = data;
|
GdkWaylandTabletToolData *tool = data;
|
||||||
GdkWaylandTabletData *tablet = tool->current_tablet;
|
GdkWaylandTabletData *tablet = tool->current_tablet;
|
||||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tool->seat);
|
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tool->seat);
|
||||||
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (seat->display);
|
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
|
||||||
|
|
||||||
if (!tablet->pointer_info.focus)
|
if (!tablet->pointer_info.focus)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_gdk_wayland_display_update_serial (wayland_display, serial);
|
_gdk_wayland_display_update_serial (display_wayland, serial);
|
||||||
tablet->pointer_info.press_serial = serial;
|
tablet->pointer_info.press_serial = serial;
|
||||||
|
|
||||||
tablet_create_button_event_frame (tablet, GDK_BUTTON_PRESS, GDK_BUTTON_PRIMARY);
|
tablet_create_button_event_frame (tablet, GDK_BUTTON_PRESS, GDK_BUTTON_PRIMARY);
|
||||||
@ -3441,14 +3441,14 @@ tablet_seat_handle_tablet_added (void *data,
|
|||||||
struct zwp_tablet_v1 *wp_tablet)
|
struct zwp_tablet_v1 *wp_tablet)
|
||||||
{
|
{
|
||||||
GdkWaylandSeat *seat = data;
|
GdkWaylandSeat *seat = data;
|
||||||
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (seat->display);
|
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
|
||||||
GdkWaylandTabletData *tablet;
|
GdkWaylandTabletData *tablet;
|
||||||
|
|
||||||
tablet = g_new0 (GdkWaylandTabletData, 1);
|
tablet = g_new0 (GdkWaylandTabletData, 1);
|
||||||
tablet->seat = GDK_SEAT (seat);
|
tablet->seat = GDK_SEAT (seat);
|
||||||
tablet->pointer_info.current_output_scale = 1;
|
tablet->pointer_info.current_output_scale = 1;
|
||||||
tablet->pointer_info.pointer_surface =
|
tablet->pointer_info.pointer_surface =
|
||||||
wl_compositor_create_surface (wayland_display->compositor);
|
wl_compositor_create_surface (display_wayland->compositor);
|
||||||
tablet->wp_tablet = wp_tablet;
|
tablet->wp_tablet = wp_tablet;
|
||||||
|
|
||||||
seat->tablets = g_list_prepend (seat->tablets, tablet);
|
seat->tablets = g_list_prepend (seat->tablets, tablet);
|
||||||
@ -3530,11 +3530,11 @@ pointer_surface_update_scale (GdkDevice *device)
|
|||||||
{
|
{
|
||||||
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device));
|
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device));
|
||||||
GdkWaylandPointerData *pointer = GDK_WAYLAND_DEVICE (device)->pointer;
|
GdkWaylandPointerData *pointer = GDK_WAYLAND_DEVICE (device)->pointer;
|
||||||
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (seat->display);
|
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
|
||||||
guint32 scale;
|
guint32 scale;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
|
||||||
if (wayland_display->compositor_version < WL_SURFACE_HAS_BUFFER_SCALE)
|
if (display_wayland->compositor_version < WL_SURFACE_HAS_BUFFER_SCALE)
|
||||||
{
|
{
|
||||||
/* We can't set the scale on this surface */
|
/* We can't set the scale on this surface */
|
||||||
return;
|
return;
|
||||||
@ -3544,7 +3544,7 @@ pointer_surface_update_scale (GdkDevice *device)
|
|||||||
for (l = pointer->pointer_surface_outputs; l != NULL; l = l->next)
|
for (l = pointer->pointer_surface_outputs; l != NULL; l = l->next)
|
||||||
{
|
{
|
||||||
guint32 output_scale =
|
guint32 output_scale =
|
||||||
_gdk_wayland_screen_get_output_scale (wayland_display->screen,
|
_gdk_wayland_screen_get_output_scale (display_wayland->screen,
|
||||||
l->data);
|
l->data);
|
||||||
scale = MAX (scale, output_scale);
|
scale = MAX (scale, output_scale);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,7 +73,7 @@
|
|||||||
* ]|
|
* ]|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *wayland_display);
|
static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland);
|
||||||
|
|
||||||
G_DEFINE_TYPE (GdkWaylandDisplay, gdk_wayland_display, GDK_TYPE_DISPLAY)
|
G_DEFINE_TYPE (GdkWaylandDisplay, gdk_wayland_display, GDK_TYPE_DISPLAY)
|
||||||
|
|
||||||
@ -111,9 +111,9 @@ xdg_shell_ping (void *data,
|
|||||||
struct xdg_shell *xdg_shell,
|
struct xdg_shell *xdg_shell,
|
||||||
uint32_t serial)
|
uint32_t serial)
|
||||||
{
|
{
|
||||||
GdkWaylandDisplay *wayland_display = data;
|
GdkWaylandDisplay *display_wayland = data;
|
||||||
|
|
||||||
_gdk_wayland_display_update_serial (wayland_display, serial);
|
_gdk_wayland_display_update_serial (display_wayland, serial);
|
||||||
|
|
||||||
GDK_NOTE (EVENTS,
|
GDK_NOTE (EVENTS,
|
||||||
g_message ("ping, shell %p, serial %u\n", xdg_shell, serial));
|
g_message ("ping, shell %p, serial %u\n", xdg_shell, serial));
|
||||||
@ -876,18 +876,18 @@ gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
|||||||
const gchar *name,
|
const gchar *name,
|
||||||
gint size)
|
gint size)
|
||||||
{
|
{
|
||||||
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY(display);
|
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY(display);
|
||||||
struct wl_cursor_theme *theme;
|
struct wl_cursor_theme *theme;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
g_assert (wayland_display);
|
g_assert (display_wayland);
|
||||||
g_assert (wayland_display->shm);
|
g_assert (display_wayland->shm);
|
||||||
|
|
||||||
if (g_strcmp0 (name, wayland_display->cursor_theme_name) == 0 &&
|
if (g_strcmp0 (name, display_wayland->cursor_theme_name) == 0 &&
|
||||||
wayland_display->cursor_theme_size == size)
|
display_wayland->cursor_theme_size == size)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
theme = wl_cursor_theme_load (name, size, wayland_display->shm);
|
theme = wl_cursor_theme_load (name, size, display_wayland->shm);
|
||||||
if (theme == NULL)
|
if (theme == NULL)
|
||||||
{
|
{
|
||||||
g_warning ("Failed to load cursor theme %s", name);
|
g_warning ("Failed to load cursor theme %s", name);
|
||||||
@ -896,87 +896,87 @@ gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
|||||||
|
|
||||||
for (i = 0; i < GDK_WAYLAND_THEME_SCALES_COUNT; i++)
|
for (i = 0; i < GDK_WAYLAND_THEME_SCALES_COUNT; i++)
|
||||||
{
|
{
|
||||||
if (wayland_display->scaled_cursor_themes[i])
|
if (display_wayland->scaled_cursor_themes[i])
|
||||||
{
|
{
|
||||||
wl_cursor_theme_destroy (wayland_display->scaled_cursor_themes[i]);
|
wl_cursor_theme_destroy (display_wayland->scaled_cursor_themes[i]);
|
||||||
wayland_display->scaled_cursor_themes[i] = NULL;
|
display_wayland->scaled_cursor_themes[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wayland_display->scaled_cursor_themes[0] = theme;
|
display_wayland->scaled_cursor_themes[0] = theme;
|
||||||
if (wayland_display->cursor_theme_name != NULL)
|
if (display_wayland->cursor_theme_name != NULL)
|
||||||
g_free (wayland_display->cursor_theme_name);
|
g_free (display_wayland->cursor_theme_name);
|
||||||
wayland_display->cursor_theme_name = g_strdup (name);
|
display_wayland->cursor_theme_name = g_strdup (name);
|
||||||
wayland_display->cursor_theme_size = size;
|
display_wayland->cursor_theme_size = size;
|
||||||
|
|
||||||
_gdk_wayland_display_update_cursors (wayland_display);
|
_gdk_wayland_display_update_cursors (display_wayland);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wl_cursor_theme *
|
struct wl_cursor_theme *
|
||||||
_gdk_wayland_display_get_scaled_cursor_theme (GdkWaylandDisplay *wayland_display,
|
_gdk_wayland_display_get_scaled_cursor_theme (GdkWaylandDisplay *display_wayland,
|
||||||
guint scale)
|
guint scale)
|
||||||
{
|
{
|
||||||
struct wl_cursor_theme *theme;
|
struct wl_cursor_theme *theme;
|
||||||
|
|
||||||
g_assert (wayland_display->cursor_theme_name);
|
g_assert (display_wayland->cursor_theme_name);
|
||||||
g_assert (scale <= GDK_WAYLAND_MAX_THEME_SCALE);
|
g_assert (scale <= GDK_WAYLAND_MAX_THEME_SCALE);
|
||||||
g_assert (scale >= 1);
|
g_assert (scale >= 1);
|
||||||
|
|
||||||
theme = wayland_display->scaled_cursor_themes[scale - 1];
|
theme = display_wayland->scaled_cursor_themes[scale - 1];
|
||||||
if (!theme)
|
if (!theme)
|
||||||
{
|
{
|
||||||
theme = wl_cursor_theme_load (wayland_display->cursor_theme_name,
|
theme = wl_cursor_theme_load (display_wayland->cursor_theme_name,
|
||||||
wayland_display->cursor_theme_size * scale,
|
display_wayland->cursor_theme_size * scale,
|
||||||
wayland_display->shm);
|
display_wayland->shm);
|
||||||
if (theme == NULL)
|
if (theme == NULL)
|
||||||
{
|
{
|
||||||
g_warning ("Failed to load cursor theme %s with scale %u",
|
g_warning ("Failed to load cursor theme %s with scale %u",
|
||||||
wayland_display->cursor_theme_name, scale);
|
display_wayland->cursor_theme_name, scale);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
wayland_display->scaled_cursor_themes[scale - 1] = theme;
|
display_wayland->scaled_cursor_themes[scale - 1] = theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
return theme;
|
return theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *wayland_display)
|
_gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland)
|
||||||
{
|
{
|
||||||
guint size;
|
guint size;
|
||||||
const gchar *name;
|
const gchar *name;
|
||||||
GValue v = G_VALUE_INIT;
|
GValue v = G_VALUE_INIT;
|
||||||
|
|
||||||
g_assert (wayland_display);
|
g_assert (display_wayland);
|
||||||
g_assert (wayland_display->shm);
|
g_assert (display_wayland->shm);
|
||||||
|
|
||||||
g_value_init (&v, G_TYPE_INT);
|
g_value_init (&v, G_TYPE_INT);
|
||||||
if (gdk_screen_get_setting (wayland_display->screen, "gtk-cursor-theme-size", &v))
|
if (gdk_screen_get_setting (display_wayland->screen, "gtk-cursor-theme-size", &v))
|
||||||
size = g_value_get_int (&v);
|
size = g_value_get_int (&v);
|
||||||
else
|
else
|
||||||
size = 32;
|
size = 32;
|
||||||
g_value_unset (&v);
|
g_value_unset (&v);
|
||||||
|
|
||||||
g_value_init (&v, G_TYPE_STRING);
|
g_value_init (&v, G_TYPE_STRING);
|
||||||
if (gdk_screen_get_setting (wayland_display->screen, "gtk-cursor-theme-name", &v))
|
if (gdk_screen_get_setting (display_wayland->screen, "gtk-cursor-theme-name", &v))
|
||||||
name = g_value_get_string (&v);
|
name = g_value_get_string (&v);
|
||||||
else
|
else
|
||||||
name = "default";
|
name = "default";
|
||||||
|
|
||||||
gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (wayland_display), name, size);
|
gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (display_wayland), name, size);
|
||||||
g_value_unset (&v);
|
g_value_unset (&v);
|
||||||
}
|
}
|
||||||
|
|
||||||
guint32
|
guint32
|
||||||
_gdk_wayland_display_get_serial (GdkWaylandDisplay *wayland_display)
|
_gdk_wayland_display_get_serial (GdkWaylandDisplay *display_wayland)
|
||||||
{
|
{
|
||||||
return wayland_display->serial;
|
return display_wayland->serial;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_gdk_wayland_display_update_serial (GdkWaylandDisplay *wayland_display,
|
_gdk_wayland_display_update_serial (GdkWaylandDisplay *display_wayland,
|
||||||
guint32 serial)
|
guint32 serial)
|
||||||
{
|
{
|
||||||
wayland_display->serial = serial;
|
display_wayland->serial = serial;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1170,7 +1170,7 @@ _gdk_wayland_is_shm_surface (cairo_surface_t *surface)
|
|||||||
GdkWaylandSelection *
|
GdkWaylandSelection *
|
||||||
gdk_wayland_display_get_selection (GdkDisplay *display)
|
gdk_wayland_display_get_selection (GdkDisplay *display)
|
||||||
{
|
{
|
||||||
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (display);
|
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||||
|
|
||||||
return wayland_display->selection;
|
return display_wayland->selection;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -304,7 +304,7 @@ gdk_wayland_drag_context_drop_finish (GdkDragContext *context,
|
|||||||
guint32 time)
|
guint32 time)
|
||||||
{
|
{
|
||||||
GdkDisplay *display = gdk_device_get_display (gdk_drag_context_get_device (context));
|
GdkDisplay *display = gdk_device_get_display (gdk_drag_context_get_device (context));
|
||||||
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (display);
|
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||||
GdkWaylandDragContext *wayland_context;
|
GdkWaylandDragContext *wayland_context;
|
||||||
struct wl_data_offer *wl_offer;
|
struct wl_data_offer *wl_offer;
|
||||||
GdkAtom selection;
|
GdkAtom selection;
|
||||||
@ -318,7 +318,7 @@ gdk_wayland_drag_context_drop_finish (GdkDragContext *context,
|
|||||||
{
|
{
|
||||||
gdk_wayland_drag_context_commit_status (context);
|
gdk_wayland_drag_context_commit_status (context);
|
||||||
|
|
||||||
if (wayland_display->data_device_manager_version >=
|
if (display_wayland->data_device_manager_version >=
|
||||||
WL_DATA_OFFER_FINISH_SINCE_VERSION)
|
WL_DATA_OFFER_FINISH_SINCE_VERSION)
|
||||||
wl_data_offer_finish (wl_offer);
|
wl_data_offer_finish (wl_offer);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,7 +60,7 @@ void _gdk_wayland_display_init_cursors (GdkWaylandDisplay *display);
|
|||||||
void _gdk_wayland_display_finalize_cursors (GdkWaylandDisplay *display);
|
void _gdk_wayland_display_finalize_cursors (GdkWaylandDisplay *display);
|
||||||
void _gdk_wayland_display_update_cursors (GdkWaylandDisplay *display);
|
void _gdk_wayland_display_update_cursors (GdkWaylandDisplay *display);
|
||||||
|
|
||||||
struct wl_cursor_theme * _gdk_wayland_display_get_scaled_cursor_theme (GdkWaylandDisplay *wayland_display,
|
struct wl_cursor_theme * _gdk_wayland_display_get_scaled_cursor_theme (GdkWaylandDisplay *display_wayland,
|
||||||
guint scale);
|
guint scale);
|
||||||
|
|
||||||
GdkCursor *_gdk_wayland_display_get_cursor_for_type (GdkDisplay *display,
|
GdkCursor *_gdk_wayland_display_get_cursor_for_type (GdkDisplay *display,
|
||||||
@ -226,8 +226,9 @@ void _gdk_wayland_screen_set_has_gtk_shell (GdkScreen *screen);
|
|||||||
void _gdk_wayland_window_set_grab_seat (GdkWindow *window,
|
void _gdk_wayland_window_set_grab_seat (GdkWindow *window,
|
||||||
GdkSeat *seat);
|
GdkSeat *seat);
|
||||||
|
|
||||||
guint32 _gdk_wayland_display_get_serial (GdkWaylandDisplay *wayland_display);
|
guint32 _gdk_wayland_display_get_serial (GdkWaylandDisplay *display_wayland);
|
||||||
void _gdk_wayland_display_update_serial (GdkWaylandDisplay *wayland_display, guint32 serial);
|
void _gdk_wayland_display_update_serial (GdkWaylandDisplay *display_wayland,
|
||||||
|
guint32 serial);
|
||||||
|
|
||||||
cairo_surface_t * _gdk_wayland_display_create_shm_surface (GdkWaylandDisplay *display,
|
cairo_surface_t * _gdk_wayland_display_create_shm_surface (GdkWaylandDisplay *display,
|
||||||
int width,
|
int width,
|
||||||
|
|||||||
@ -664,9 +664,10 @@ struct gtk_shell1_listener gdk_screen_gtk_shell_listener = {
|
|||||||
void
|
void
|
||||||
_gdk_wayland_screen_set_has_gtk_shell (GdkScreen *screen)
|
_gdk_wayland_screen_set_has_gtk_shell (GdkScreen *screen)
|
||||||
{
|
{
|
||||||
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (GDK_WAYLAND_SCREEN (screen)->display);
|
GdkWaylandDisplay *display_wayland =
|
||||||
|
GDK_WAYLAND_DISPLAY (GDK_WAYLAND_SCREEN (screen)->display);
|
||||||
|
|
||||||
gtk_shell1_add_listener (wayland_display->gtk_shell,
|
gtk_shell1_add_listener (display_wayland->gtk_shell,
|
||||||
&gdk_screen_gtk_shell_listener,
|
&gdk_screen_gtk_shell_listener,
|
||||||
screen);
|
screen);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1453,7 +1453,7 @@ gboolean
|
|||||||
gdk_wayland_selection_set_current_offer_actions (GdkDisplay *display,
|
gdk_wayland_selection_set_current_offer_actions (GdkDisplay *display,
|
||||||
uint32_t action)
|
uint32_t action)
|
||||||
{
|
{
|
||||||
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (display);
|
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||||
struct wl_data_offer *offer;
|
struct wl_data_offer *offer;
|
||||||
uint32_t all_actions = 0;
|
uint32_t all_actions = 0;
|
||||||
|
|
||||||
@ -1467,7 +1467,7 @@ gdk_wayland_selection_set_current_offer_actions (GdkDisplay *display,
|
|||||||
WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE |
|
WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE |
|
||||||
WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK;
|
WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK;
|
||||||
|
|
||||||
if (wayland_display->data_device_manager_version >=
|
if (display_wayland->data_device_manager_version >=
|
||||||
WL_DATA_OFFER_SET_ACTIONS_SINCE_VERSION)
|
WL_DATA_OFFER_SET_ACTIONS_SINCE_VERSION)
|
||||||
wl_data_offer_set_actions (offer, all_actions, action);
|
wl_data_offer_set_actions (offer, all_actions, action);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|||||||
@ -291,12 +291,12 @@ _gdk_wayland_screen_create_root_window (GdkScreen *screen,
|
|||||||
int width,
|
int width,
|
||||||
int height)
|
int height)
|
||||||
{
|
{
|
||||||
GdkWaylandDisplay *wayland_display =
|
GdkWaylandDisplay *display_wayland =
|
||||||
GDK_WAYLAND_DISPLAY (gdk_screen_get_display (screen));
|
GDK_WAYLAND_DISPLAY (gdk_screen_get_display (screen));
|
||||||
GdkWindow *window;
|
GdkWindow *window;
|
||||||
GdkWindowImplWayland *impl;
|
GdkWindowImplWayland *impl;
|
||||||
|
|
||||||
window = _gdk_display_create_window (GDK_DISPLAY (wayland_display));
|
window = _gdk_display_create_window (GDK_DISPLAY (display_wayland));
|
||||||
window->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_WAYLAND, NULL);
|
window->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_WAYLAND, NULL);
|
||||||
window->impl_window = window;
|
window->impl_window = window;
|
||||||
window->visual = gdk_screen_get_system_visual (screen);
|
window->visual = gdk_screen_get_system_visual (screen);
|
||||||
@ -304,7 +304,7 @@ _gdk_wayland_screen_create_root_window (GdkScreen *screen,
|
|||||||
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
||||||
|
|
||||||
impl->wrapper = GDK_WINDOW (window);
|
impl->wrapper = GDK_WINDOW (window);
|
||||||
if (wayland_display->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE &&
|
if (display_wayland->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE &&
|
||||||
gdk_screen_get_n_monitors (screen) > 0)
|
gdk_screen_get_n_monitors (screen) > 0)
|
||||||
impl->scale = gdk_screen_get_monitor_scale_factor (screen, 0);
|
impl->scale = gdk_screen_get_monitor_scale_factor (screen, 0);
|
||||||
|
|
||||||
@ -428,7 +428,8 @@ frame_callback (void *data,
|
|||||||
{
|
{
|
||||||
GdkWindow *window = data;
|
GdkWindow *window = data;
|
||||||
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
||||||
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
|
GdkWaylandDisplay *display_wayland =
|
||||||
|
GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
|
||||||
GdkFrameClock *clock = gdk_window_get_frame_clock (window);
|
GdkFrameClock *clock = gdk_window_get_frame_clock (window);
|
||||||
GdkFrameTimings *timings;
|
GdkFrameTimings *timings;
|
||||||
|
|
||||||
@ -457,8 +458,9 @@ frame_callback (void *data,
|
|||||||
{
|
{
|
||||||
/* We pick a random output out of the outputs that the window touches
|
/* We pick a random output out of the outputs that the window touches
|
||||||
* The rate here is in milli-hertz */
|
* The rate here is in milli-hertz */
|
||||||
int refresh_rate = _gdk_wayland_screen_get_output_refresh_rate (wayland_display->screen,
|
int refresh_rate =
|
||||||
impl->display_server.outputs->data);
|
_gdk_wayland_screen_get_output_refresh_rate (display_wayland->screen,
|
||||||
|
impl->display_server.outputs->data);
|
||||||
if (refresh_rate != 0)
|
if (refresh_rate != 0)
|
||||||
timings->refresh_interval = G_GINT64_CONSTANT(1000000000) / refresh_rate;
|
timings->refresh_interval = G_GINT64_CONSTANT(1000000000) / refresh_rate;
|
||||||
}
|
}
|
||||||
@ -552,11 +554,12 @@ static void
|
|||||||
window_update_scale (GdkWindow *window)
|
window_update_scale (GdkWindow *window)
|
||||||
{
|
{
|
||||||
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
||||||
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
|
GdkWaylandDisplay *display_wayland =
|
||||||
|
GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
|
||||||
guint32 scale;
|
guint32 scale;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
|
||||||
if (wayland_display->compositor_version < WL_SURFACE_HAS_BUFFER_SCALE)
|
if (display_wayland->compositor_version < WL_SURFACE_HAS_BUFFER_SCALE)
|
||||||
{
|
{
|
||||||
/* We can't set the scale on this surface */
|
/* We can't set the scale on this surface */
|
||||||
return;
|
return;
|
||||||
@ -566,7 +569,7 @@ window_update_scale (GdkWindow *window)
|
|||||||
for (l = impl->display_server.outputs; l != NULL; l = l->next)
|
for (l = impl->display_server.outputs; l != NULL; l = l->next)
|
||||||
{
|
{
|
||||||
guint32 output_scale =
|
guint32 output_scale =
|
||||||
_gdk_wayland_screen_get_output_scale (wayland_display->screen, l->data);
|
_gdk_wayland_screen_get_output_scale (display_wayland->screen, l->data);
|
||||||
scale = MAX (scale, output_scale);
|
scale = MAX (scale, output_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -593,7 +596,7 @@ _gdk_wayland_display_create_window_impl (GdkDisplay *display,
|
|||||||
GdkWindowAttr *attributes,
|
GdkWindowAttr *attributes,
|
||||||
gint attributes_mask)
|
gint attributes_mask)
|
||||||
{
|
{
|
||||||
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (display);
|
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||||
GdkWindowImplWayland *impl;
|
GdkWindowImplWayland *impl;
|
||||||
GdkFrameClock *frame_clock;
|
GdkFrameClock *frame_clock;
|
||||||
const char *title;
|
const char *title;
|
||||||
@ -616,7 +619,7 @@ _gdk_wayland_display_create_window_impl (GdkDisplay *display,
|
|||||||
g_object_ref (window);
|
g_object_ref (window);
|
||||||
|
|
||||||
/* More likely to be right than just assuming 1 */
|
/* More likely to be right than just assuming 1 */
|
||||||
if (wayland_display->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE &&
|
if (display_wayland->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE &&
|
||||||
gdk_screen_get_n_monitors (screen) > 0)
|
gdk_screen_get_n_monitors (screen) > 0)
|
||||||
impl->scale = gdk_screen_get_monitor_scale_factor (screen, 0);
|
impl->scale = gdk_screen_get_monitor_scale_factor (screen, 0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user