[gtk/fix-inspector-picking] inspector: Make picking work again



commit fd58b116cf4f25ae9950f27d1b2ba3ae721401df
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Mar 21 09:42:58 2020 -0400

    inspector: Make picking work again
    
    We used to either make the inspector see- and click-thru
    or lower it, but sadly translucency broke after we
    removed surface opacity, and lowering doesn't work
    on Wayland. So just hide the inspector window while
    we are picking.
    
    Fixes: #2528

 gtk/inspector/inspect-button.c | 38 +++-----------------------------------
 1 file changed, 3 insertions(+), 35 deletions(-)
---
diff --git a/gtk/inspector/inspect-button.c b/gtk/inspector/inspect-button.c
index 6a88555052..64c198f2dc 100644
--- a/gtk/inspector/inspect-button.c
+++ b/gtk/inspector/inspect-button.c
@@ -99,9 +99,7 @@ on_inspect_widget (GtkInspectorWindow *iw,
 {
   GtkWidget *widget;
 
-#if 0
-  gdk_surface_raise (gtk_native_get_surface (GTK_NATIVE (iw)));
-#endif
+  gtk_window_present (GTK_WINDOW (iw));
 
   clear_flash (iw);
 
@@ -114,20 +112,7 @@ on_inspect_widget (GtkInspectorWindow *iw,
 static void
 reemphasize_window (GtkWidget *window)
 {
-  GdkDisplay *display;
-
-  display = gtk_widget_get_display (window);
-  if (gdk_display_is_composited (display))
-    {
-      GtkInspectorWindow *iw = GTK_INSPECTOR_WINDOW (window);
-
-      gtk_widget_set_opacity (window, 1.0);
-      gtk_window_set_extra_input_region (GTK_WINDOW (iw), NULL);
-    }
-#if 0
-  else
-    gdk_surface_raise (gtk_native_get_surface (GTK_NATIVE (window)));
-#endif
+  gtk_window_present (GTK_WINDOW (window));
 }
 
 static gboolean handle_event (GtkInspectorWindow *iw, GdkEvent *event);
@@ -196,24 +181,7 @@ void
 gtk_inspector_on_inspect (GtkWidget          *button,
                           GtkInspectorWindow *iw)
 {
-  GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (iw));
-
-  /* de-emphasize window */
-  if (gdk_display_is_composited (display))
-    {
-      cairo_rectangle_int_t rect;
-      cairo_region_t *region;
-
-      gtk_widget_set_opacity (GTK_WIDGET (iw), 0.3);
-      rect.x = rect.y = rect.width = rect.height = 0;
-      region = cairo_region_create_rectangle (&rect);
-      gtk_window_set_extra_input_region (GTK_WINDOW (iw), region);
-      cairo_region_destroy (region);
-    }
-#if 0
-  else
-    gdk_surface_lower (gtk_native_get_surface (GTK_NATIVE (iw)));
-#endif
+  gtk_widget_hide (GTK_WIDGET (iw));
 
   g_signal_connect (iw, "event", G_CALLBACK (handle_event), NULL);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]