Revert "wayland: Add support for gtk_surface1_titlebar_gesture()"

This reverts commit 45ba6e9329.

This caused regressions in libhandy-using applications.

Fixes: #5389
This commit is contained in:
Matthias Clasen 2023-01-27 21:33:38 -05:00
parent 9811485990
commit 5aaa373b70
9 changed files with 4 additions and 140 deletions

View File

@ -22,8 +22,7 @@ gdk__private__ (void)
gdk_get_desktop_autostart_id,
gdk_profiler_is_running,
gdk_profiler_start,
gdk_profiler_stop,
gdk_window_titlebar_gesture,
gdk_profiler_stop
};
return &table;

View File

@ -66,9 +66,6 @@ typedef struct {
gboolean (* gdk_profiler_is_running) (void);
void (* gdk_profiler_start) (int fd);
void (* gdk_profiler_stop) (void);
gboolean (* gdk_window_titlebar_gesture) (GdkWindow *window,
GdkTitlebarGesture gesture);
} GdkPrivateVTable;
GDK_AVAILABLE_IN_ALL

View File

@ -557,9 +557,6 @@ void _gdk_synthesize_crossing_events_for_geometry_change (GdkWindow *changed_win
gboolean _gdk_window_has_impl (GdkWindow *window);
GdkWindow * _gdk_window_get_impl_window (GdkWindow *window);
gboolean gdk_window_titlebar_gesture (GdkWindow *window,
GdkTitlebarGesture gesture);
/*****************************
* offscreen window routines *
*****************************/

View File

@ -11998,20 +11998,3 @@ gdk_window_show_window_menu (GdkWindow *window,
else
return FALSE;
}
gboolean
gdk_window_titlebar_gesture (GdkWindow *window,
GdkTitlebarGesture gesture)
{
GdkWindowImplClass *impl_class;
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
g_return_val_if_fail (!GDK_WINDOW_DESTROYED (window), FALSE);
impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
if (impl_class->titlebar_gesture)
return impl_class->titlebar_gesture (window, gesture);
else
return FALSE;
}

View File

@ -30,13 +30,6 @@
G_BEGIN_DECLS
typedef enum
{
GDK_TITLEBAR_GESTURE_DOUBLE_CLICK = 1,
GDK_TITLEBAR_GESTURE_RIGHT_CLICK = 2,
GDK_TITLEBAR_GESTURE_MIDDLE_CLICK = 3
} GdkTitlebarGesture;
#define GDK_TYPE_WINDOW_IMPL (gdk_window_impl_get_type ())
#define GDK_WINDOW_IMPL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW_IMPL, GdkWindowImpl))
#define GDK_WINDOW_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW_IMPL, GdkWindowImplClass))
@ -322,9 +315,6 @@ struct _GdkWindowImplClass
const cairo_region_t *region);
void (* destroy_draw_context) (GdkWindow *window,
GdkDrawingContext *context);
gboolean (* titlebar_gesture) (GdkWindow *window,
GdkTitlebarGesture gesture);
};
/* Interface Functions */

View File

@ -84,7 +84,7 @@
#define MIN_SYSTEM_BELL_DELAY_MS 20
#define GTK_SHELL1_VERSION 5
#define GTK_SHELL1_VERSION 4
#ifdef HAVE_XDG_ACTIVATION
#define XDG_ACTIVATION_VERSION 1
#endif

View File

@ -4871,65 +4871,6 @@ gdk_wayland_window_show_window_menu (GdkWindow *window,
return TRUE;
}
static gboolean
translate_gesture (GdkTitlebarGesture gesture,
enum gtk_surface1_gesture *out_gesture)
{
switch (gesture)
{
case GDK_TITLEBAR_GESTURE_DOUBLE_CLICK:
*out_gesture = GTK_SURFACE1_GESTURE_DOUBLE_CLICK;
break;
case GDK_TITLEBAR_GESTURE_RIGHT_CLICK:
*out_gesture = GTK_SURFACE1_GESTURE_RIGHT_CLICK;
break;
case GDK_TITLEBAR_GESTURE_MIDDLE_CLICK:
*out_gesture = GTK_SURFACE1_GESTURE_MIDDLE_CLICK;
break;
default:
g_warning ("Not handling unknown titlebar gesture %u", gesture);
return FALSE;
}
return TRUE;
}
static gboolean
gdk_wayland_window_titlebar_gesture (GdkWindow *window,
GdkTitlebarGesture gesture)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
struct gtk_surface1 *gtk_surface = impl->display_server.gtk_surface;
enum gtk_surface1_gesture gtk_gesture;
GdkSeat *seat;
struct wl_seat *wl_seat;
uint32_t serial;
if (!gtk_surface)
return FALSE;
if (gtk_surface1_get_version (gtk_surface) < GTK_SURFACE1_TITLEBAR_GESTURE_SINCE_VERSION)
return FALSE;
if (!translate_gesture (gesture, &gtk_gesture))
return FALSE;
seat = gdk_display_get_default_seat (gdk_window_get_display (window));
wl_seat = gdk_wayland_seat_get_wl_seat (seat);
serial = _gdk_wayland_seat_get_last_implicit_grab_serial (seat, NULL);
gtk_surface1_titlebar_gesture (impl->display_server.gtk_surface,
serial,
wl_seat,
gtk_gesture);
return TRUE;
}
static void
_gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
{
@ -5021,7 +4962,6 @@ _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
impl_class->show_window_menu = gdk_wayland_window_show_window_menu;
impl_class->create_gl_context = gdk_wayland_window_create_gl_context;
impl_class->invalidate_for_new_frame = gdk_wayland_window_invalidate_for_new_frame;
impl_class->titlebar_gesture = gdk_wayland_window_titlebar_gesture;
signals[COMMITTED] = g_signal_new ("committed",
G_TYPE_FROM_CLASS (object_class),

View File

@ -1,6 +1,6 @@
<protocol name="gtk">
<interface name="gtk_shell1" version="5">
<interface name="gtk_shell1" version="4">
<description summary="gtk specific extensions">
gtk_shell is a protocol extension providing additional features for
clients implementing it.
@ -35,7 +35,7 @@
</request>
</interface>
<interface name="gtk_surface1" version="5">
<interface name="gtk_surface1" version="4">
<request name="set_dbus_properties">
<arg name="application_id" type="string" allow-null="true"/>
<arg name="app_menu_path" type="string" allow-null="true"/>
@ -85,23 +85,6 @@
<!-- Version 4 additions -->
<request name="release" type="destructor" since="4"/>
<!-- Version 5 additions -->
<enum name="gesture" since="5">
<entry name="double_click" value="1"/>
<entry name="right_click" value="2"/>
<entry name="middle_click" value="3"/>
</enum>
<enum name="error" since="5">
<entry name="invalid_gesture" value="0"/>
</enum>
<request name="titlebar_gesture" since="5">
<arg name="serial" type="uint"/>
<arg name="seat" type="object" interface="wl_seat"/>
<arg name="gesture" type="uint" enum="gesture"/>
</request>
</interface>
</protocol>

View File

@ -1385,34 +1385,10 @@ gtk_window_titlebar_action (GtkWindow *window,
guint button,
gint n_press)
{
GdkTitlebarGesture gesture = 0;
GdkWindow *gdk_window;
GtkSettings *settings;
gchar *action = NULL;
gboolean retval = TRUE;
switch (button)
{
case GDK_BUTTON_PRIMARY:
if (n_press == 2)
gesture = GDK_TITLEBAR_GESTURE_DOUBLE_CLICK;
break;
case GDK_BUTTON_MIDDLE:
gesture = GDK_TITLEBAR_GESTURE_MIDDLE_CLICK;
break;
case GDK_BUTTON_SECONDARY:
gesture = GDK_TITLEBAR_GESTURE_RIGHT_CLICK;
break;
}
gdk_window = _gtk_widget_get_window (GTK_WIDGET (window));
if (gesture &&
GDK_PRIVATE_CALL (gdk_window_titlebar_gesture (gdk_window, gesture)))
{
retval = TRUE;
goto out;
}
settings = gtk_widget_get_settings (GTK_WIDGET (window));
switch (button)
{
@ -1458,7 +1434,6 @@ gtk_window_titlebar_action (GtkWindow *window,
g_free (action);
out:
return retval;
}