Drop GTK_DEBUG_TOUCHSCREEN

This flag was never doing much, and is only raising
the wrong expectations. Remove it.

Fixes: #5893
This commit is contained in:
Matthias Clasen 2023-07-22 16:41:39 -04:00
parent b5b797b0aa
commit 0751f59ee8
9 changed files with 8 additions and 107 deletions

View File

@ -73,9 +73,6 @@ A number of keys are influencing behavior instead of just logging:
`no-css-cache`
: Bypass caching for CSS style properties
`touchscreen`
: Pretend the pointer is a touchscreen device
`snapshot`
: Include debug render nodes in the generated snapshots

View File

@ -46,7 +46,6 @@ G_BEGIN_DECLS
* @GTK_DEBUG_SIZE_REQUEST: Information about size requests
* @GTK_DEBUG_NO_CSS_CACHE: Disable the style property cache
* @GTK_DEBUG_INTERACTIVE: Open the GTK inspector
* @GTK_DEBUG_TOUCHSCREEN: Pretend the pointer is a touchscreen
* @GTK_DEBUG_ACTIONS: Information about actions and menu models
* @GTK_DEBUG_LAYOUT: Information from layout managers
* @GTK_DEBUG_SNAPSHOT: Include debug render nodes in the generated snapshots
@ -73,7 +72,6 @@ typedef enum {
GTK_DEBUG_SIZE_REQUEST = 1 << 8,
GTK_DEBUG_NO_CSS_CACHE = 1 << 9,
GTK_DEBUG_INTERACTIVE = 1 << 10,
GTK_DEBUG_TOUCHSCREEN = 1 << 11,
GTK_DEBUG_ACTIONS = 1 << 12,
GTK_DEBUG_LAYOUT = 1 << 13,
GTK_DEBUG_SNAPSHOT = 1 << 14,

View File

@ -139,7 +139,7 @@ gtk_gesture_single_handle_event (GtkEventController *controller,
GdkDevice *source_device;
GdkInputSource source;
guint button = 0, state, i;
gboolean retval, test_touchscreen = FALSE;
gboolean retval;
GdkEventType event_type;
source_device = gdk_event_get_device (event);
@ -150,9 +150,6 @@ gtk_gesture_single_handle_event (GtkEventController *controller,
priv = gtk_gesture_single_get_instance_private (GTK_GESTURE_SINGLE (controller));
source = gdk_device_get_source (source_device);
if (source != GDK_SOURCE_TOUCHSCREEN)
test_touchscreen = gtk_simulate_touchscreen ();
event_type = gdk_event_get_event_type (event);
switch ((guint) event_type)
@ -168,7 +165,7 @@ gtk_gesture_single_handle_event (GtkEventController *controller,
break;
case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
if (priv->touch_only && !test_touchscreen && source != GDK_SOURCE_TOUCHSCREEN)
if (priv->touch_only && source != GDK_SOURCE_TOUCHSCREEN)
return FALSE;
button = gdk_button_event_get_button (event);
@ -176,7 +173,7 @@ gtk_gesture_single_handle_event (GtkEventController *controller,
case GDK_MOTION_NOTIFY:
if (!gtk_gesture_handles_sequence (GTK_GESTURE (controller), sequence))
return FALSE;
if (priv->touch_only && !test_touchscreen && source != GDK_SOURCE_TOUCHSCREEN)
if (priv->touch_only && source != GDK_SOURCE_TOUCHSCREEN)
return FALSE;
state = gdk_event_get_modifier_state (event);

View File

@ -180,12 +180,6 @@ gtk_set_debug_flags (GtkDebugFlags flags)
gtk_set_display_debug_flags (gdk_display_get_default (), flags);
}
gboolean
gtk_simulate_touchscreen (void)
{
return (gtk_get_debug_flags () & GTK_DEBUG_TOUCHSCREEN) != 0;
}
static const GdkDebugKey gtk_debug_keys[] = {
{ "keybindings", GTK_DEBUG_KEYBINDINGS, "Information about keyboard shortcuts" },
{ "modules", GTK_DEBUG_MODULES, "Information about modules and extensions" },
@ -202,7 +196,6 @@ static const GdkDebugKey gtk_debug_keys[] = {
{ "builder-objects", GTK_DEBUG_BUILDER_OBJECTS, "Log unused GtkBuilder objects" },
{ "no-css-cache", GTK_DEBUG_NO_CSS_CACHE, "Disable style property cache" },
{ "interactive", GTK_DEBUG_INTERACTIVE, "Enable the GTK inspector", TRUE },
{ "touchscreen", GTK_DEBUG_TOUCHSCREEN, "Pretend the pointer is a touchscreen" },
{ "snapshot", GTK_DEBUG_SNAPSHOT, "Generate debug render nodes" },
{ "accessibility", GTK_DEBUG_A11Y, "Information about accessibility state changes" },
{ "iconfallback", GTK_DEBUG_ICONFALLBACK, "Information about icon fallback" },

View File

@ -125,8 +125,6 @@ guint gtk_get_portal_interface_version (GDBusConnection *connection,
void _gtk_load_dll_with_libgtk3_manifest (const char *dllname);
#endif
gboolean gtk_simulate_touchscreen (void);
void gtk_set_display_debug_flags (GdkDisplay *display,
GtkDebugFlags flags);
GtkDebugFlags gtk_get_display_debug_flags (GdkDisplay *display);

View File

@ -2797,8 +2797,7 @@ gtk_text_click_gesture_pressed (GtkGestureClick *gesture,
have_selection = sel_start != sel_end;
source = gdk_event_get_device (event);
is_touchscreen = gtk_simulate_touchscreen () ||
gdk_device_get_source (source) == GDK_SOURCE_TOUCHSCREEN;
is_touchscreen = gdk_device_get_source (source) == GDK_SOURCE_TOUCHSCREEN;
priv->text_handles_enabled = is_touchscreen;
@ -3161,8 +3160,7 @@ gtk_text_drag_gesture_update (GtkGestureDrag *gesture,
gtk_text_set_positions (self, pos, bound);
/* Update touch handles' position */
if (gtk_simulate_touchscreen () ||
input_source == GDK_SOURCE_TOUCHSCREEN)
if (input_source == GDK_SOURCE_TOUCHSCREEN)
{
priv->text_handles_enabled = TRUE;
gtk_text_update_handles (self);

View File

@ -5598,8 +5598,7 @@ gtk_text_view_click_gesture_pressed (GtkGestureClick *gesture,
gtk_text_view_reset_blink_time (text_view);
device = gdk_event_get_device ((GdkEvent *) event);
is_touchscreen = gtk_simulate_touchscreen () ||
gdk_device_get_source (device) == GDK_SOURCE_TOUCHSCREEN;
is_touchscreen = gdk_device_get_source (device) == GDK_SOURCE_TOUCHSCREEN;
if (n_press == 1)
{
@ -7487,8 +7486,7 @@ gtk_text_view_drag_gesture_update (GtkGestureDrag *gesture,
device = gdk_event_get_device (event);
is_touchscreen = gtk_simulate_touchscreen () ||
gdk_device_get_source (device) == GDK_SOURCE_TOUCHSCREEN;
is_touchscreen = gdk_device_get_source (device) == GDK_SOURCE_TOUCHSCREEN;
get_iter_from_gesture (text_view, text_view->priv->drag_gesture,
&cursor, NULL, NULL);
@ -7629,8 +7627,7 @@ gtk_text_view_drag_gesture_end (GtkGestureDrag *gesture,
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
device = gdk_event_get_device (event);
is_touchscreen = gtk_simulate_touchscreen () ||
gdk_device_get_source (device) == GDK_SOURCE_TOUCHSCREEN;
is_touchscreen = gdk_device_get_source (device) == GDK_SOURCE_TOUCHSCREEN;
if ((is_touchscreen || clicked_in_selection) &&
!gtk_drag_check_threshold_double (GTK_WIDGET (text_view), 0, 0, offset_x, offset_y))

View File

@ -97,9 +97,6 @@ struct _GtkInspectorVisual
GtkWidget *focus_switch;
GtkWidget *a11y_switch;
GtkWidget *misc_box;
GtkWidget *touchscreen_switch;
GtkInspectorOverlay *fps_overlay;
GtkInspectorOverlay *updates_overlay;
GtkInspectorOverlay *layout_overlay;
@ -973,29 +970,6 @@ init_slowdown (GtkInspectorVisual *vis)
G_CALLBACK (slowdown_entry_activated), vis);
}
static void
update_touchscreen (GtkSwitch *sw)
{
GtkDebugFlags flags;
flags = gtk_get_debug_flags ();
if (gtk_switch_get_active (sw))
flags |= GTK_DEBUG_TOUCHSCREEN;
else
flags &= ~GTK_DEBUG_TOUCHSCREEN;
gtk_set_debug_flags (flags);
}
static void
init_touchscreen (GtkInspectorVisual *vis)
{
gtk_switch_set_active (GTK_SWITCH (vis->touchscreen_switch), (gtk_get_debug_flags () & GTK_DEBUG_TOUCHSCREEN) != 0);
g_signal_connect (vis->touchscreen_switch, "notify::active",
G_CALLBACK (update_touchscreen), NULL);
}
static gboolean
keynav_failed (GtkWidget *widget, GtkDirectionType direction, GtkInspectorVisual *vis)
{
@ -1004,15 +978,9 @@ keynav_failed (GtkWidget *widget, GtkDirectionType direction, GtkInspectorVisual
if (direction == GTK_DIR_DOWN &&
widget == vis->visual_box)
next = vis->debug_box;
else if (direction == GTK_DIR_DOWN &&
widget == vis->debug_box)
next = vis->misc_box;
else if (direction == GTK_DIR_UP &&
widget == vis->debug_box)
next = vis->visual_box;
else if (direction == GTK_DIR_UP &&
widget == vis->misc_box)
next = vis->debug_box;
else
next = NULL;
@ -1070,11 +1038,6 @@ row_activated (GtkListBox *box,
GtkSwitch *sw = GTK_SWITCH (vis->focus_switch);
gtk_switch_set_active (sw, !gtk_switch_get_active (sw));
}
else if (gtk_widget_is_ancestor (vis->touchscreen_switch, GTK_WIDGET (row)))
{
GtkSwitch *sw = GTK_SWITCH (vis->touchscreen_switch);
gtk_switch_set_active (sw, !gtk_switch_get_active (sw));
}
else if (gtk_widget_is_ancestor (vis->a11y_switch, GTK_WIDGET (row)))
{
GtkSwitch *sw = GTK_SWITCH (vis->a11y_switch);
@ -1112,10 +1075,8 @@ gtk_inspector_visual_constructed (GObject *object)
g_signal_connect (vis->visual_box, "keynav-failed", G_CALLBACK (keynav_failed), vis);
g_signal_connect (vis->debug_box, "keynav-failed", G_CALLBACK (keynav_failed), vis);
g_signal_connect (vis->misc_box, "keynav-failed", G_CALLBACK (keynav_failed), vis);
g_signal_connect (vis->visual_box, "row-activated", G_CALLBACK (row_activated), vis);
g_signal_connect (vis->debug_box, "row-activated", G_CALLBACK (row_activated), vis);
g_signal_connect (vis->misc_box, "row-activated", G_CALLBACK (row_activated), vis);
}
static void
@ -1189,11 +1150,9 @@ gtk_inspector_visual_class_init (GtkInspectorVisualClass *klass)
gtk_widget_class_bind_template_child (widget_class, GtkInspectorVisual, animation_switch);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorVisual, slowdown_adjustment);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorVisual, slowdown_entry);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorVisual, touchscreen_switch);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorVisual, visual_box);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorVisual, debug_box);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorVisual, font_button);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorVisual, misc_box);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorVisual, font_scale_entry);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorVisual, font_scale_adjustment);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorVisual, fps_switch);
@ -1234,7 +1193,6 @@ gtk_inspector_visual_set_display (GtkInspectorVisual *vis,
init_scale (vis);
init_animation (vis);
init_slowdown (vis);
init_touchscreen (vis);
init_gl (vis);
}

View File

@ -652,40 +652,6 @@
</child>
</object>
</child>
<child>
<object class="GtkListBox" id="misc_box">
<property name="selection-mode">none</property>
<property name="halign">center</property>
<style>
<class name="rich-list"/>
<class name="boxed-list"/>
</style>
<child>
<object class="GtkListBoxRow">
<child>
<object class="GtkBox">
<property name="spacing">40</property>
<child>
<object class="GtkLabel" id="touchscreen_label">
<property name="label" translatable="yes">Simulate Touchscreen</property>
<property name="halign">start</property>
<property name="valign">baseline</property>
<property name="xalign">0.0</property>
</object>
</child>
<child>
<object class="GtkSwitch" id="touchscreen_switch">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBox" id="inspector_box">
<property name="selection-mode">none</property>
@ -753,7 +719,6 @@
<widgets>
<widget name="visual_box"/>
<widget name="debug_box"/>
<widget name="misc_box"/>
<widget name="inspector_box"/>
</widgets>
</object>