gnome-shell/SOURCES/perf-tool-wayland.patch
2021-10-08 11:28:42 +00:00

125 lines
3.8 KiB
Diff

From 3c4c37e4d0668d748ee792f7580defdf4780624a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Thu, 5 Dec 2019 14:12:47 +0100
Subject: [PATCH 1/2] perf-helper: Add content for custom drawing
Drawing windows got a lot more involved with the advent of client-side
decorations. Instead of accounting for visible and invisible borders,
titlebar and shadows when necessary, just add an empty child for the
custom drawing.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/887
---
src/shell-perf-helper.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/shell-perf-helper.c b/src/shell-perf-helper.c
index f115dcbdc..ba1754e02 100644
--- a/src/shell-perf-helper.c
+++ b/src/shell-perf-helper.c
@@ -119,9 +119,9 @@ on_window_map_event (GtkWidget *window,
}
static gboolean
-on_window_draw (GtkWidget *window,
- cairo_t *cr,
- WindowInfo *info)
+on_child_draw (GtkWidget *window,
+ cairo_t *cr,
+ WindowInfo *info)
{
cairo_rectangle_int_t allocation;
double x_offset, y_offset;
@@ -203,6 +203,7 @@ create_window (int width,
gboolean redraws)
{
WindowInfo *info;
+ GtkWidget *child;
info = g_new0 (WindowInfo, 1);
info->width = width;
@@ -218,10 +219,13 @@ create_window (int width,
info->pending = TRUE;
info->start_time = -1;
+ child = g_object_new (GTK_TYPE_BOX, "visible", TRUE, "app-paintable", TRUE, NULL);
+ gtk_container_add (GTK_CONTAINER (info->window), child);
+
gtk_widget_set_size_request (info->window, width, height);
gtk_widget_set_app_paintable (info->window, TRUE);
g_signal_connect (info->window, "map-event", G_CALLBACK (on_window_map_event), info);
- g_signal_connect (info->window, "draw", G_CALLBACK (on_window_draw), info);
+ g_signal_connect (child, "draw", G_CALLBACK (on_child_draw), info);
gtk_widget_show (info->window);
if (info->redraws)
--
2.23.0
From 0185c288c3e6b82b76f2a0704aab0e2ab20b75b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Thu, 5 Dec 2019 13:29:38 +0100
Subject: [PATCH 2/2] perf-helper: Remove unused atoms
Those aren't used for anything, but make the helper dependent on X11.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/887
---
src/shell-perf-helper.c | 18 ------------------
1 file changed, 18 deletions(-)
diff --git a/src/shell-perf-helper.c b/src/shell-perf-helper.c
index ba1754e02..a50376e2e 100644
--- a/src/shell-perf-helper.c
+++ b/src/shell-perf-helper.c
@@ -12,7 +12,6 @@
#include <math.h>
#include <gtk/gtk.h>
-#include <gdk/gdkx.h>
#define BUS_NAME "org.gnome.Shell.PerfHelper"
@@ -60,12 +59,6 @@ static GOptionEntry opt_entries[] =
{ NULL }
};
-static Display *xdisplay;
-static Window xroot;
-static Atom atom_wm_state;
-static Atom atom__net_wm_name;
-static Atom atom_utf8_string;
-
static guint timeout_id;
static GList *our_windows;
static GList *wait_windows_invocations;
@@ -350,8 +343,6 @@ on_name_lost (GDBusConnection *connection,
int
main (int argc, char **argv)
{
- GdkDisplay *display;
- GdkScreen *screen;
GOptionContext *context;
GError *error = NULL;
@@ -367,15 +358,6 @@ main (int argc, char **argv)
return 1;
}
- display = gdk_display_get_default ();
- screen = gdk_screen_get_default ();
-
- xdisplay = gdk_x11_display_get_xdisplay (display);
- xroot = gdk_x11_window_get_xid (gdk_screen_get_root_window (screen));
- atom_wm_state = gdk_x11_get_xatom_by_name_for_display (display, "WM_STATE");
- atom__net_wm_name = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_NAME");
- atom_utf8_string = gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING");
-
g_bus_own_name (G_BUS_TYPE_SESSION,
BUS_NAME,
G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT |
--
2.23.0