Revert "wayland: Add support for xdg-output"
This reverts commit 1f64689c31.
This was leading to blurry output, and needs more work.
See https://gitlab.gnome.org/GNOME/gtk/issues/1901
This commit is contained in:
@ -33,8 +33,6 @@ BUILT_SOURCES = \
|
|||||||
gtk-primary-selection-protocol.c \
|
gtk-primary-selection-protocol.c \
|
||||||
tablet-unstable-v2-client-protocol.h \
|
tablet-unstable-v2-client-protocol.h \
|
||||||
tablet-unstable-v2-protocol.c \
|
tablet-unstable-v2-protocol.c \
|
||||||
xdg-output-unstable-v1-protocol.c \
|
|
||||||
xdg-output-unstable-v1-client-protocol.h \
|
|
||||||
keyboard-shortcuts-inhibit-unstable-v1-client-protocol.h \
|
keyboard-shortcuts-inhibit-unstable-v1-client-protocol.h \
|
||||||
keyboard-shortcuts-inhibit-unstable-v1-protocol.c \
|
keyboard-shortcuts-inhibit-unstable-v1-protocol.c \
|
||||||
server-decoration-client-protocol.h \
|
server-decoration-client-protocol.h \
|
||||||
|
|||||||
@ -513,13 +513,6 @@ gdk_registry_handle_global (void *data,
|
|||||||
&server_decoration_listener,
|
&server_decoration_listener,
|
||||||
display_wayland);
|
display_wayland);
|
||||||
}
|
}
|
||||||
else if (strcmp(interface, "zxdg_output_manager_v1") == 0)
|
|
||||||
{
|
|
||||||
display_wayland->xdg_output_manager =
|
|
||||||
wl_registry_bind (registry, id, &zxdg_output_manager_v1_interface, 1);
|
|
||||||
_gdk_wayland_screen_init_xdg_output (display_wayland->screen);
|
|
||||||
_gdk_wayland_display_async_roundtrip (display_wayland);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_hash_table_insert (display_wayland->known_globals,
|
g_hash_table_insert (display_wayland->known_globals,
|
||||||
GUINT_TO_POINTER (id), g_strdup (interface));
|
GUINT_TO_POINTER (id), g_strdup (interface));
|
||||||
|
|||||||
@ -34,7 +34,6 @@
|
|||||||
#include <gdk/wayland/xdg-foreign-unstable-v1-client-protocol.h>
|
#include <gdk/wayland/xdg-foreign-unstable-v1-client-protocol.h>
|
||||||
#include <gdk/wayland/keyboard-shortcuts-inhibit-unstable-v1-client-protocol.h>
|
#include <gdk/wayland/keyboard-shortcuts-inhibit-unstable-v1-client-protocol.h>
|
||||||
#include <gdk/wayland/server-decoration-client-protocol.h>
|
#include <gdk/wayland/server-decoration-client-protocol.h>
|
||||||
#include <gdk/wayland/xdg-output-unstable-v1-client-protocol.h>
|
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <gdk/gdkkeys.h>
|
#include <gdk/gdkkeys.h>
|
||||||
@ -94,7 +93,6 @@ struct _GdkWaylandDisplay
|
|||||||
struct zxdg_importer_v1 *xdg_importer;
|
struct zxdg_importer_v1 *xdg_importer;
|
||||||
struct zwp_keyboard_shortcuts_inhibit_manager_v1 *keyboard_shortcuts_inhibit;
|
struct zwp_keyboard_shortcuts_inhibit_manager_v1 *keyboard_shortcuts_inhibit;
|
||||||
struct org_kde_kwin_server_decoration_manager *server_decoration_manager;
|
struct org_kde_kwin_server_decoration_manager *server_decoration_manager;
|
||||||
struct zxdg_output_manager_v1 *xdg_output_manager;
|
|
||||||
|
|
||||||
GList *async_roundtrips;
|
GList *async_roundtrips;
|
||||||
|
|
||||||
|
|||||||
@ -30,15 +30,6 @@ struct _GdkWaylandMonitor {
|
|||||||
guint32 version;
|
guint32 version;
|
||||||
struct wl_output *output;
|
struct wl_output *output;
|
||||||
gboolean added;
|
gboolean added;
|
||||||
|
|
||||||
struct zxdg_output_v1 *xdg_output;
|
|
||||||
/* Size and position, can be either from wl_output or xdg_output */
|
|
||||||
int32_t x;
|
|
||||||
int32_t y;
|
|
||||||
int32_t width;
|
|
||||||
int32_t height;
|
|
||||||
gboolean wl_output_done;
|
|
||||||
gboolean xdg_output_done;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GdkWaylandMonitorClass {
|
struct _GdkWaylandMonitorClass {
|
||||||
|
|||||||
@ -227,8 +227,6 @@ struct wl_output *_gdk_wayland_screen_get_wl_output (GdkScreen *screen,
|
|||||||
|
|
||||||
void _gdk_wayland_screen_set_has_gtk_shell (GdkScreen *screen);
|
void _gdk_wayland_screen_set_has_gtk_shell (GdkScreen *screen);
|
||||||
|
|
||||||
void _gdk_wayland_screen_init_xdg_output (GdkScreen *screen);
|
|
||||||
|
|
||||||
void _gdk_wayland_window_set_grab_seat (GdkWindow *window,
|
void _gdk_wayland_window_set_grab_seat (GdkWindow *window,
|
||||||
GdkSeat *seat);
|
GdkSeat *seat);
|
||||||
|
|
||||||
|
|||||||
@ -1422,117 +1422,6 @@ transform_to_string (int transform)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static gboolean
|
|
||||||
screen_has_xdg_output_support (GdkScreen *screen)
|
|
||||||
{
|
|
||||||
GdkDisplay *display = gdk_screen_get_display (screen);
|
|
||||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
|
||||||
|
|
||||||
return (display_wayland->xdg_output_manager != NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
monitor_has_xdg_output (GdkWaylandMonitor *monitor)
|
|
||||||
{
|
|
||||||
return (monitor->xdg_output != NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
should_update_monitor (GdkWaylandMonitor *monitor)
|
|
||||||
{
|
|
||||||
return (GDK_MONITOR (monitor)->geometry.width != 0 &&
|
|
||||||
monitor->version < OUTPUT_VERSION_WITH_DONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
apply_monitor_change (GdkWaylandMonitor *monitor)
|
|
||||||
{
|
|
||||||
GdkDisplay *display = GDK_MONITOR (monitor)->display;
|
|
||||||
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (gdk_display_get_default_screen (display));
|
|
||||||
|
|
||||||
GDK_NOTE (MISC,
|
|
||||||
g_message ("monitor %d changed position %d %d, size %d %d",
|
|
||||||
monitor->id,
|
|
||||||
monitor->x, monitor->y,
|
|
||||||
monitor->width, monitor->height));
|
|
||||||
|
|
||||||
gdk_monitor_set_position (GDK_MONITOR (monitor), monitor->x, monitor->y);
|
|
||||||
gdk_monitor_set_size (GDK_MONITOR (monitor), monitor->width, monitor->height);
|
|
||||||
monitor->wl_output_done = FALSE;
|
|
||||||
monitor->xdg_output_done = FALSE;
|
|
||||||
|
|
||||||
g_signal_emit_by_name (screen_wayland, "monitors-changed");
|
|
||||||
update_screen_size (screen_wayland);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
xdg_output_handle_logical_position (void *data,
|
|
||||||
struct zxdg_output_v1 *xdg_output,
|
|
||||||
int32_t x,
|
|
||||||
int32_t y)
|
|
||||||
{
|
|
||||||
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *) data;
|
|
||||||
|
|
||||||
GDK_NOTE (MISC,
|
|
||||||
g_message ("handle logical position xdg-output %d, position %d %d",
|
|
||||||
monitor->id, x, y));
|
|
||||||
monitor->x = x;
|
|
||||||
monitor->y = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
xdg_output_handle_logical_size (void *data,
|
|
||||||
struct zxdg_output_v1 *xdg_output,
|
|
||||||
int32_t width,
|
|
||||||
int32_t height)
|
|
||||||
{
|
|
||||||
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *) data;
|
|
||||||
|
|
||||||
GDK_NOTE (MISC,
|
|
||||||
g_message ("handle logical size xdg-output %d, size %d %d",
|
|
||||||
monitor->id, width, height));
|
|
||||||
monitor->width = width;
|
|
||||||
monitor->height = height;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
xdg_output_handle_done (void *data,
|
|
||||||
struct zxdg_output_v1 *xdg_output)
|
|
||||||
{
|
|
||||||
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *) data;
|
|
||||||
|
|
||||||
GDK_NOTE (MISC,
|
|
||||||
g_message ("handle done xdg-output %d", monitor->id));
|
|
||||||
|
|
||||||
monitor->xdg_output_done = TRUE;
|
|
||||||
if (monitor->wl_output_done)
|
|
||||||
apply_monitor_change (monitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct zxdg_output_v1_listener xdg_output_listener = {
|
|
||||||
xdg_output_handle_logical_position,
|
|
||||||
xdg_output_handle_logical_size,
|
|
||||||
xdg_output_handle_done,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
gdk_wayland_screen_get_xdg_output (GdkWaylandMonitor *monitor)
|
|
||||||
{
|
|
||||||
GdkDisplay *display = GDK_MONITOR (monitor)->display;
|
|
||||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
|
||||||
|
|
||||||
GDK_NOTE (MISC,
|
|
||||||
g_message ("get xdg-output for monitor %d", monitor->id));
|
|
||||||
|
|
||||||
monitor->xdg_output =
|
|
||||||
zxdg_output_manager_v1_get_xdg_output (display_wayland->xdg_output_manager,
|
|
||||||
monitor->output);
|
|
||||||
|
|
||||||
zxdg_output_v1_add_listener (monitor->xdg_output,
|
|
||||||
&xdg_output_listener,
|
|
||||||
monitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
output_handle_geometry (void *data,
|
output_handle_geometry (void *data,
|
||||||
struct wl_output *wl_output,
|
struct wl_output *wl_output,
|
||||||
@ -1551,15 +1440,19 @@ output_handle_geometry (void *data,
|
|||||||
g_message ("handle geometry output %d, position %d %d, phys. size %d %d, subpixel layout %s, manufacturer %s, model %s, transform %s",
|
g_message ("handle geometry output %d, position %d %d, phys. size %d %d, subpixel layout %s, manufacturer %s, model %s, transform %s",
|
||||||
monitor->id, x, y, physical_width, physical_height, subpixel_to_string (subpixel), make, model, transform_to_string (transform)));
|
monitor->id, x, y, physical_width, physical_height, subpixel_to_string (subpixel), make, model, transform_to_string (transform)));
|
||||||
|
|
||||||
monitor->x = x;
|
gdk_monitor_set_position (GDK_MONITOR (monitor), x, y);
|
||||||
monitor->y = y;
|
|
||||||
gdk_monitor_set_physical_size (GDK_MONITOR (monitor), physical_width, physical_height);
|
gdk_monitor_set_physical_size (GDK_MONITOR (monitor), physical_width, physical_height);
|
||||||
gdk_monitor_set_subpixel_layout (GDK_MONITOR (monitor), subpixel);
|
gdk_monitor_set_subpixel_layout (GDK_MONITOR (monitor), subpixel);
|
||||||
gdk_monitor_set_manufacturer (GDK_MONITOR (monitor), make);
|
gdk_monitor_set_manufacturer (GDK_MONITOR (monitor), make);
|
||||||
gdk_monitor_set_model (GDK_MONITOR (monitor), model);
|
gdk_monitor_set_model (GDK_MONITOR (monitor), model);
|
||||||
|
|
||||||
if (should_update_monitor (monitor) || !monitor_has_xdg_output (monitor))
|
if (GDK_MONITOR (monitor)->geometry.width != 0 && monitor->version < OUTPUT_VERSION_WITH_DONE)
|
||||||
apply_monitor_change (monitor);
|
{
|
||||||
|
GdkDisplay *display = GDK_MONITOR (monitor)->display;
|
||||||
|
GdkWaylandScreen *screen = GDK_WAYLAND_SCREEN (gdk_display_get_default_screen (display));
|
||||||
|
g_signal_emit_by_name (screen, "monitors-changed");
|
||||||
|
update_screen_size (screen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1567,14 +1460,21 @@ output_handle_done (void *data,
|
|||||||
struct wl_output *wl_output)
|
struct wl_output *wl_output)
|
||||||
{
|
{
|
||||||
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data;
|
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data;
|
||||||
|
GdkDisplay *display = gdk_monitor_get_display (GDK_MONITOR (monitor));
|
||||||
|
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (gdk_display_get_default_screen (display));
|
||||||
|
|
||||||
GDK_NOTE (MISC,
|
GDK_NOTE (MISC,
|
||||||
g_message ("handle done output %d", monitor->id));
|
g_message ("handle done output %d", monitor->id));
|
||||||
|
|
||||||
monitor->wl_output_done = TRUE;
|
if (!monitor->added)
|
||||||
|
{
|
||||||
|
monitor->added = TRUE;
|
||||||
|
g_ptr_array_add (GDK_WAYLAND_DISPLAY (display)->monitors, monitor);
|
||||||
|
gdk_display_monitor_added (display, GDK_MONITOR (monitor));
|
||||||
|
}
|
||||||
|
|
||||||
if (!monitor_has_xdg_output (monitor) || monitor->xdg_output_done)
|
g_signal_emit_by_name (screen_wayland, "monitors-changed");
|
||||||
apply_monitor_change (monitor);
|
update_screen_size (screen_wayland);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1591,9 +1491,6 @@ output_handle_scale (void *data,
|
|||||||
GDK_NOTE (MISC,
|
GDK_NOTE (MISC,
|
||||||
g_message ("handle scale output %d, scale %d", monitor->id, scale));
|
g_message ("handle scale output %d, scale %d", monitor->id, scale));
|
||||||
|
|
||||||
if (monitor_has_xdg_output (monitor))
|
|
||||||
return;
|
|
||||||
|
|
||||||
gdk_monitor_get_geometry (GDK_MONITOR (monitor), &previous_geometry);
|
gdk_monitor_get_geometry (GDK_MONITOR (monitor), &previous_geometry);
|
||||||
previous_scale = gdk_monitor_get_scale_factor (GDK_MONITOR (monitor));
|
previous_scale = gdk_monitor_get_scale_factor (GDK_MONITOR (monitor));
|
||||||
|
|
||||||
@ -1601,11 +1498,13 @@ output_handle_scale (void *data,
|
|||||||
height = previous_geometry.height * previous_scale;
|
height = previous_geometry.height * previous_scale;
|
||||||
|
|
||||||
gdk_monitor_set_scale_factor (GDK_MONITOR (monitor), scale);
|
gdk_monitor_set_scale_factor (GDK_MONITOR (monitor), scale);
|
||||||
monitor->width = width / scale;
|
gdk_monitor_set_size (GDK_MONITOR (monitor), width / scale, height / scale);
|
||||||
monitor->height = height / scale;
|
|
||||||
|
|
||||||
if (should_update_monitor (monitor))
|
if (GDK_MONITOR (monitor)->geometry.width != 0 && monitor->version < OUTPUT_VERSION_WITH_DONE)
|
||||||
apply_monitor_change (monitor);
|
{
|
||||||
|
GdkScreen *screen = gdk_display_get_default_screen (GDK_MONITOR (monitor)->display);
|
||||||
|
g_signal_emit_by_name (screen, "monitors-changed");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1627,12 +1526,15 @@ output_handle_mode (void *data,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
scale = gdk_monitor_get_scale_factor (GDK_MONITOR (monitor));
|
scale = gdk_monitor_get_scale_factor (GDK_MONITOR (monitor));
|
||||||
monitor->width = width / scale;
|
gdk_monitor_set_size (GDK_MONITOR (monitor), width / scale, height / scale);
|
||||||
monitor->height = height / scale;
|
|
||||||
gdk_monitor_set_refresh_rate (GDK_MONITOR (monitor), refresh);
|
gdk_monitor_set_refresh_rate (GDK_MONITOR (monitor), refresh);
|
||||||
|
|
||||||
if (should_update_monitor (monitor) || !monitor_has_xdg_output (monitor))
|
if (width != 0 && monitor->version < OUTPUT_VERSION_WITH_DONE)
|
||||||
apply_monitor_change (monitor);
|
{
|
||||||
|
GdkScreen *screen = gdk_display_get_default_screen (GDK_MONITOR (monitor)->display);
|
||||||
|
g_signal_emit_by_name (screen, "monitors-changed");
|
||||||
|
update_screen_size (GDK_WAYLAND_SCREEN (screen));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_output_listener output_listener =
|
static const struct wl_output_listener output_listener =
|
||||||
@ -1660,16 +1562,13 @@ _gdk_wayland_screen_add_output (GdkScreen *screen,
|
|||||||
monitor->output = output;
|
monitor->output = output;
|
||||||
monitor->version = version;
|
monitor->version = version;
|
||||||
|
|
||||||
|
if (monitor->version < OUTPUT_VERSION_WITH_DONE)
|
||||||
|
{
|
||||||
g_ptr_array_add (GDK_WAYLAND_DISPLAY (display)->monitors, monitor);
|
g_ptr_array_add (GDK_WAYLAND_DISPLAY (display)->monitors, monitor);
|
||||||
gdk_display_monitor_added (display, GDK_MONITOR (monitor));
|
gdk_display_monitor_added (display, GDK_MONITOR (monitor));
|
||||||
|
}
|
||||||
|
|
||||||
wl_output_add_listener (output, &output_listener, monitor);
|
wl_output_add_listener (output, &output_listener, monitor);
|
||||||
|
|
||||||
GDK_NOTE (MISC,
|
|
||||||
g_message ("xdg_output_manager %p",
|
|
||||||
GDK_WAYLAND_DISPLAY (display)->xdg_output_manager));
|
|
||||||
|
|
||||||
if (screen_has_xdg_output_support (screen))
|
|
||||||
gdk_wayland_screen_get_xdg_output (monitor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wl_output *
|
struct wl_output *
|
||||||
@ -1767,18 +1666,3 @@ _gdk_wayland_screen_get_output_scale (GdkScreen *screen,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
_gdk_wayland_screen_init_xdg_output (GdkScreen *screen)
|
|
||||||
{
|
|
||||||
GdkDisplay *display = gdk_screen_get_display (screen);
|
|
||||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
|
||||||
int i;
|
|
||||||
|
|
||||||
GDK_NOTE (MISC,
|
|
||||||
g_message ("init xdg-output support, %d monitor(s) already present",
|
|
||||||
display_wayland->monitors->len));
|
|
||||||
|
|
||||||
for (i = 0; i < display_wayland->monitors->len; i++)
|
|
||||||
gdk_wayland_screen_get_xdg_output (display_wayland->monitors->pdata[i]);
|
|
||||||
}
|
|
||||||
|
|||||||
@ -55,7 +55,6 @@ proto_sources = [
|
|||||||
['tablet', 'unstable', 'v2', ],
|
['tablet', 'unstable', 'v2', ],
|
||||||
['keyboard-shortcuts-inhibit', 'unstable', 'v1', ],
|
['keyboard-shortcuts-inhibit', 'unstable', 'v1', ],
|
||||||
['server-decoration', 'private' ],
|
['server-decoration', 'private' ],
|
||||||
['xdg-output', 'unstable', 'v1', ],
|
|
||||||
]
|
]
|
||||||
|
|
||||||
gdk_wayland_gen_headers = []
|
gdk_wayland_gen_headers = []
|
||||||
|
|||||||
Reference in New Issue
Block a user