|
Leigh Scott |
af8ceeb |
From 6b917facf2753552164e669892af929e54dc7834 Mon Sep 17 00:00:00 2001
|
|
Leigh Scott |
af8ceeb |
From: Michael Webster <miketwebster@gmail.com>
|
|
Leigh Scott |
af8ceeb |
Date: Tue, 26 Dec 2023 11:36:25 -0500
|
|
Leigh Scott |
af8ceeb |
Subject: [PATCH] backup locker: Restore stack management when not activated.
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
This is mainly a revert of commit 654e33993.
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
As of linuxmint/muffin@bf234250143d2b, muffin won't go nuts when
|
|
Leigh Scott |
af8ceeb |
encountering a screen-sized override-redirect window, and
|
|
Leigh Scott |
af8ceeb |
our stage and backup locker can behave properly again (like
|
|
Leigh Scott |
af8ceeb |
pre-5.2).
|
|
Leigh Scott |
af8ceeb |
---
|
|
Leigh Scott |
af8ceeb |
backup-locker/cs-backup-locker.c | 179 ++++++----------------
|
|
Leigh Scott |
af8ceeb |
libcscreensaver/cs-gdk-event-filter-x11.c | 13 ++
|
|
Leigh Scott |
af8ceeb |
2 files changed, 59 insertions(+), 133 deletions(-)
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
diff --git a/backup-locker/cs-backup-locker.c b/backup-locker/cs-backup-locker.c
|
|
Leigh Scott |
af8ceeb |
index a27eee2..06f4cfd 100644
|
|
Leigh Scott |
af8ceeb |
--- a/backup-locker/cs-backup-locker.c
|
|
Leigh Scott |
af8ceeb |
+++ b/backup-locker/cs-backup-locker.c
|
|
Leigh Scott |
af8ceeb |
@@ -29,7 +29,6 @@ static guint sigterm_src_id;
|
|
Leigh Scott |
af8ceeb |
G_DECLARE_FINAL_TYPE (BackupWindow, backup_window, BACKUP, WINDOW, GtkWindow)
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
static void setup_window_monitor (BackupWindow *window, gulong xid);
|
|
Leigh Scott |
af8ceeb |
-static void quit (BackupWindow *window);
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
struct _BackupWindow
|
|
Leigh Scott |
af8ceeb |
{
|
|
Leigh Scott |
af8ceeb |
@@ -41,7 +40,6 @@ struct _BackupWindow
|
|
Leigh Scott |
af8ceeb |
CsEventGrabber *grabber;
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
gulong pretty_xid;
|
|
Leigh Scott |
af8ceeb |
- guint activate_idle_id;
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
gboolean should_grab;
|
|
Leigh Scott |
af8ceeb |
};
|
|
Leigh Scott |
af8ceeb |
@@ -99,26 +97,15 @@ root_window_size_changed (CsGdkEventFilter *filter,
|
|
Leigh Scott |
af8ceeb |
gtk_widget_queue_resize (GTK_WIDGET (window));
|
|
Leigh Scott |
af8ceeb |
}
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
-static void
|
|
Leigh Scott |
af8ceeb |
-set_active_background (BackupWindow *window,
|
|
Leigh Scott |
af8ceeb |
- gboolean active)
|
|
Leigh Scott |
af8ceeb |
+static gboolean
|
|
Leigh Scott |
af8ceeb |
+paint_background (GtkWidget *widget,
|
|
Leigh Scott |
af8ceeb |
+ cairo_t *cr,
|
|
Leigh Scott |
af8ceeb |
+ gpointer user_data)
|
|
Leigh Scott |
af8ceeb |
{
|
|
Leigh Scott |
af8ceeb |
- GtkStyleContext *context;
|
|
Leigh Scott |
af8ceeb |
-
|
|
Leigh Scott |
af8ceeb |
- context = gtk_widget_get_style_context (GTK_WIDGET (window));
|
|
Leigh Scott |
af8ceeb |
+ cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0);
|
|
Leigh Scott |
af8ceeb |
+ cairo_paint (cr);
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
- if (active)
|
|
Leigh Scott |
af8ceeb |
- {
|
|
Leigh Scott |
af8ceeb |
- gtk_style_context_remove_class (context, "backup-dormant");
|
|
Leigh Scott |
af8ceeb |
- gtk_style_context_add_class (context, "backup-active");
|
|
Leigh Scott |
af8ceeb |
- }
|
|
Leigh Scott |
af8ceeb |
- else
|
|
Leigh Scott |
af8ceeb |
- {
|
|
Leigh Scott |
af8ceeb |
- gtk_style_context_remove_class (context, "backup-active");
|
|
Leigh Scott |
af8ceeb |
- gtk_style_context_add_class (context, "backup-dormant");
|
|
Leigh Scott |
af8ceeb |
- }
|
|
Leigh Scott |
af8ceeb |
-
|
|
Leigh Scott |
af8ceeb |
- gtk_widget_queue_draw (GTK_WIDGET (window));
|
|
Leigh Scott |
af8ceeb |
+ return FALSE;
|
|
Leigh Scott |
af8ceeb |
}
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
static void
|
|
Leigh Scott |
af8ceeb |
@@ -133,45 +120,21 @@ backup_window_show (GtkWidget *widget)
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
static void window_grab_broken (gpointer data);
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
-static gboolean
|
|
Leigh Scott |
af8ceeb |
-activate_backup_window_cb (BackupWindow *window)
|
|
Leigh Scott |
af8ceeb |
+static void
|
|
Leigh Scott |
af8ceeb |
+activate_backup_window (BackupWindow *window)
|
|
Leigh Scott |
af8ceeb |
{
|
|
Leigh Scott |
af8ceeb |
g_debug ("Grabbing input");
|
|
Leigh Scott |
af8ceeb |
+ cs_event_grabber_move_to_window (window->grabber,
|
|
Leigh Scott |
af8ceeb |
+ gtk_widget_get_window (GTK_WIDGET (window)),
|
|
Leigh Scott |
af8ceeb |
+ gtk_widget_get_screen (GTK_WIDGET (window)),
|
|
Leigh Scott |
af8ceeb |
+ FALSE);
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
- if (window->should_grab)
|
|
Leigh Scott |
af8ceeb |
- {
|
|
Leigh Scott |
af8ceeb |
- if (cs_event_grabber_grab_root (window->grabber, FALSE))
|
|
Leigh Scott |
af8ceeb |
- {
|
|
Leigh Scott |
af8ceeb |
- guint32 user_time;
|
|
Leigh Scott |
af8ceeb |
- cs_event_grabber_move_to_window (window->grabber,
|
|
Leigh Scott |
af8ceeb |
- gtk_widget_get_window (GTK_WIDGET (window)),
|
|
Leigh Scott |
af8ceeb |
- gtk_widget_get_screen (GTK_WIDGET (window)),
|
|
Leigh Scott |
af8ceeb |
- FALSE);
|
|
Leigh Scott |
af8ceeb |
- g_signal_connect_swapped (window, "grab-broken-event", G_CALLBACK (window_grab_broken), window);
|
|
Leigh Scott |
af8ceeb |
-
|
|
Leigh Scott |
af8ceeb |
- set_active_background (window, TRUE);
|
|
Leigh Scott |
af8ceeb |
+ g_signal_connect_swapped (window, "grab-broken-event", G_CALLBACK (window_grab_broken), window);
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
- user_time = gdk_x11_display_get_user_time (gtk_widget_get_display (GTK_WIDGET (window)));
|
|
Leigh Scott |
af8ceeb |
- gdk_x11_window_set_user_time (gtk_widget_get_window (GTK_WIDGET (window)), user_time);
|
|
Leigh Scott |
af8ceeb |
-
|
|
Leigh Scott |
af8ceeb |
- gtk_widget_show (window->info_box);
|
|
Leigh Scott |
af8ceeb |
- position_info_box (window);
|
|
Leigh Scott |
af8ceeb |
- }
|
|
Leigh Scott |
af8ceeb |
- else
|
|
Leigh Scott |
af8ceeb |
- {
|
|
Leigh Scott |
af8ceeb |
- return G_SOURCE_CONTINUE;
|
|
Leigh Scott |
af8ceeb |
- }
|
|
Leigh Scott |
af8ceeb |
- }
|
|
Leigh Scott |
af8ceeb |
+ gtk_widget_show (window->info_box);
|
|
Leigh Scott |
af8ceeb |
+ position_info_box (window);
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
- window->activate_idle_id = 0;
|
|
Leigh Scott |
af8ceeb |
- return G_SOURCE_REMOVE;
|
|
Leigh Scott |
af8ceeb |
-}
|
|
Leigh Scott |
af8ceeb |
-
|
|
Leigh Scott |
af8ceeb |
-static void
|
|
Leigh Scott |
af8ceeb |
-activate_backup_window (BackupWindow *window)
|
|
Leigh Scott |
af8ceeb |
-{
|
|
Leigh Scott |
af8ceeb |
- g_clear_handle_id (&window->activate_idle_id, g_source_remove);
|
|
Leigh Scott |
af8ceeb |
- window->activate_idle_id = g_idle_add ((GSourceFunc) activate_backup_window_cb, window);
|
|
Leigh Scott |
af8ceeb |
+ window->should_grab = TRUE;
|
|
Leigh Scott |
af8ceeb |
}
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
static void
|
|
Leigh Scott |
af8ceeb |
@@ -196,51 +159,34 @@ window_grab_broken (gpointer data)
|
|
Leigh Scott |
af8ceeb |
}
|
|
Leigh Scott |
af8ceeb |
}
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
-static gboolean
|
|
Leigh Scott |
af8ceeb |
-update_for_compositing (gpointer data)
|
|
Leigh Scott |
af8ceeb |
+static void
|
|
Leigh Scott |
af8ceeb |
+on_composited_changed (gpointer data)
|
|
Leigh Scott |
af8ceeb |
{
|
|
Leigh Scott |
af8ceeb |
BackupWindow *window = BACKUP_WINDOW (data);
|
|
Leigh Scott |
af8ceeb |
- GdkVisual *visual;
|
|
Leigh Scott |
af8ceeb |
- visual = gdk_screen_get_rgba_visual (gdk_screen_get_default ());
|
|
Leigh Scott |
af8ceeb |
- if (!visual)
|
|
Leigh Scott |
af8ceeb |
- {
|
|
Leigh Scott |
af8ceeb |
- g_critical ("Can't get RGBA visual to paint backup window");
|
|
Leigh Scott |
af8ceeb |
- return FALSE;
|
|
Leigh Scott |
af8ceeb |
- }
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
- if (visual != NULL && gdk_screen_is_composited (gdk_screen_get_default ()))
|
|
Leigh Scott |
af8ceeb |
+ g_debug ("Received composited-changed");
|
|
Leigh Scott |
af8ceeb |
+
|
|
Leigh Scott |
af8ceeb |
+ if (gtk_widget_get_realized (GTK_WIDGET (window)))
|
|
Leigh Scott |
af8ceeb |
{
|
|
Leigh Scott |
af8ceeb |
gtk_widget_hide (GTK_WIDGET (window));
|
|
Leigh Scott |
af8ceeb |
gtk_widget_unrealize (GTK_WIDGET (window));
|
|
Leigh Scott |
af8ceeb |
- gtk_widget_set_visual (GTK_WIDGET (window), visual);
|
|
Leigh Scott |
af8ceeb |
gtk_widget_realize (GTK_WIDGET (window));
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
+ if (window->should_grab)
|
|
Leigh Scott |
af8ceeb |
+ {
|
|
Leigh Scott |
af8ceeb |
+ guint32 user_time;
|
|
Leigh Scott |
af8ceeb |
+
|
|
Leigh Scott |
af8ceeb |
+ user_time = gdk_x11_display_get_user_time (gtk_widget_get_display (GTK_WIDGET (window)));
|
|
Leigh Scott |
af8ceeb |
+ gdk_x11_window_set_user_time (gtk_widget_get_window (GTK_WIDGET (window)), user_time);
|
|
Leigh Scott |
af8ceeb |
+ }
|
|
Leigh Scott |
af8ceeb |
+
|
|
Leigh Scott |
af8ceeb |
gtk_widget_show (GTK_WIDGET (window));
|
|
Leigh Scott |
af8ceeb |
}
|
|
Leigh Scott |
af8ceeb |
- g_debug ("update for compositing\n");
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
if (window->should_grab)
|
|
Leigh Scott |
af8ceeb |
{
|
|
Leigh Scott |
af8ceeb |
activate_backup_window (window);
|
|
Leigh Scott |
af8ceeb |
}
|
|
Leigh Scott |
af8ceeb |
-
|
|
Leigh Scott |
af8ceeb |
- return TRUE;
|
|
Leigh Scott |
af8ceeb |
-}
|
|
Leigh Scott |
af8ceeb |
-
|
|
Leigh Scott |
af8ceeb |
-static void
|
|
Leigh Scott |
af8ceeb |
-on_composited_changed (gpointer data)
|
|
Leigh Scott |
af8ceeb |
-{
|
|
Leigh Scott |
af8ceeb |
- g_debug ("Received composited-changed");
|
|
Leigh Scott |
af8ceeb |
-
|
|
Leigh Scott |
af8ceeb |
- g_return_if_fail (BACKUP_IS_WINDOW (data));
|
|
Leigh Scott |
af8ceeb |
-
|
|
Leigh Scott |
af8ceeb |
- BackupWindow *window = BACKUP_WINDOW (data);
|
|
Leigh Scott |
af8ceeb |
-
|
|
Leigh Scott |
af8ceeb |
- if (!update_for_compositing (window))
|
|
Leigh Scott |
af8ceeb |
- {
|
|
Leigh Scott |
af8ceeb |
- g_critical ("Error realizing backup-locker window - exiting");
|
|
Leigh Scott |
af8ceeb |
- quit(window);
|
|
Leigh Scott |
af8ceeb |
- }
|
|
Leigh Scott |
af8ceeb |
}
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
static void
|
|
Leigh Scott |
af8ceeb |
@@ -250,7 +196,6 @@ screensaver_window_changed (CsGdkEventFilter *filter,
|
|
Leigh Scott |
af8ceeb |
{
|
|
Leigh Scott |
af8ceeb |
backup_window_ungrab (window);
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
- set_active_background (window, FALSE);
|
|
Leigh Scott |
af8ceeb |
setup_window_monitor (window, xwindow);
|
|
Leigh Scott |
af8ceeb |
}
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
@@ -279,6 +224,10 @@ backup_window_init (BackupWindow *window)
|
|
Leigh Scott |
af8ceeb |
GtkWidget *widget;
|
|
Leigh Scott |
af8ceeb |
PangoAttrList *attrs;
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
+ gtk_window_set_decorated (GTK_WINDOW (window), FALSE);
|
|
Leigh Scott |
af8ceeb |
+ gtk_window_set_skip_taskbar_hint (GTK_WINDOW (window), TRUE);
|
|
Leigh Scott |
af8ceeb |
+ gtk_window_set_skip_pager_hint (GTK_WINDOW (window), TRUE);
|
|
Leigh Scott |
af8ceeb |
+
|
|
Leigh Scott |
af8ceeb |
gtk_widget_set_events (GTK_WIDGET (window),
|
|
Leigh Scott |
af8ceeb |
gtk_widget_get_events (GTK_WIDGET (window))
|
|
Leigh Scott |
af8ceeb |
| GDK_POINTER_MOTION_MASK
|
|
Leigh Scott |
af8ceeb |
@@ -382,6 +331,7 @@ backup_window_init (BackupWindow *window)
|
|
Leigh Scott |
af8ceeb |
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
|
Leigh Scott |
af8ceeb |
gtk_box_pack_start (GTK_BOX (box), widget, FALSE, FALSE, 6);
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
+ g_signal_connect (GTK_WIDGET (window), "draw", G_CALLBACK (paint_background), window);
|
|
Leigh Scott |
af8ceeb |
g_signal_connect_swapped (gdk_screen_get_default (), "composited-changed", G_CALLBACK (on_composited_changed), window);
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
gtk_widget_show_all (box);
|
|
Leigh Scott |
af8ceeb |
@@ -430,40 +380,20 @@ static GtkWidget *
|
|
Leigh Scott |
af8ceeb |
backup_window_new (gulong pretty_xid)
|
|
Leigh Scott |
af8ceeb |
{
|
|
Leigh Scott |
af8ceeb |
BackupWindow *window;
|
|
Leigh Scott |
af8ceeb |
- GtkStyleContext *context;
|
|
Leigh Scott |
af8ceeb |
- GtkCssProvider *provider;
|
|
Leigh Scott |
af8ceeb |
GObject *result;
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
result = g_object_new (BACKUP_TYPE_WINDOW,
|
|
Leigh Scott |
af8ceeb |
"type", GTK_WINDOW_POPUP,
|
|
Leigh Scott |
af8ceeb |
+ "app-paintable", TRUE,
|
|
Leigh Scott |
af8ceeb |
NULL);
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
window = BACKUP_WINDOW (result);
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
- context = gtk_widget_get_style_context (GTK_WIDGET (window));
|
|
Leigh Scott |
af8ceeb |
- gtk_style_context_remove_class (context, "background");
|
|
Leigh Scott |
af8ceeb |
- provider = gtk_css_provider_new ();
|
|
Leigh Scott |
af8ceeb |
- gtk_css_provider_load_from_data (provider, ".backup-dormant { background-color: transparent; }"
|
|
Leigh Scott |
af8ceeb |
- ".backup-active { background-color: black; }", -1, NULL);
|
|
Leigh Scott |
af8ceeb |
- gtk_style_context_add_provider (context,
|
|
Leigh Scott |
af8ceeb |
- GTK_STYLE_PROVIDER (provider),
|
|
Leigh Scott |
af8ceeb |
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
|
Leigh Scott |
af8ceeb |
-
|
|
Leigh Scott |
af8ceeb |
- set_active_background (window, FALSE);
|
|
Leigh Scott |
af8ceeb |
-
|
|
Leigh Scott |
af8ceeb |
window->event_filter = cs_gdk_event_filter_new (GTK_WIDGET (window), pretty_xid);
|
|
Leigh Scott |
af8ceeb |
g_signal_connect (window->event_filter, "xscreen-size", G_CALLBACK (root_window_size_changed), window);
|
|
Leigh Scott |
af8ceeb |
g_signal_connect (window->event_filter, "screensaver-window-changed", G_CALLBACK (screensaver_window_changed), window);
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
window->pretty_xid = pretty_xid;
|
|
Leigh Scott |
af8ceeb |
- window->should_grab = FALSE;
|
|
Leigh Scott |
af8ceeb |
-
|
|
Leigh Scott |
af8ceeb |
- if (!update_for_compositing (window))
|
|
Leigh Scott |
af8ceeb |
- {
|
|
Leigh Scott |
af8ceeb |
- return NULL;
|
|
Leigh Scott |
af8ceeb |
- }
|
|
Leigh Scott |
af8ceeb |
-
|
|
Leigh Scott |
af8ceeb |
- setup_window_monitor (BACKUP_WINDOW (window), window->pretty_xid);
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
return GTK_WIDGET (result);
|
|
Leigh Scott |
af8ceeb |
}
|
|
Leigh Scott |
af8ceeb |
@@ -522,19 +452,13 @@ screensaver_window_gone (GObject *source,
|
|
Leigh Scott |
af8ceeb |
// The main process will kill us, or the user will have to. Either way, grab everything.
|
|
Leigh Scott |
af8ceeb |
if (!g_cancellable_is_cancelled (task_cancellable))
|
|
Leigh Scott |
af8ceeb |
{
|
|
Leigh Scott |
af8ceeb |
+ g_debug ("Screensaver window gone: 0x%lx (pretty_xid now 0x%lx)", xid, window->pretty_xid);
|
|
Leigh Scott |
af8ceeb |
g_mutex_lock (&pretty_xid_mutex);
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
- g_debug ("Screensaver window gone: 0x%lx", xid);
|
|
Leigh Scott |
af8ceeb |
if (xid == window->pretty_xid)
|
|
Leigh Scott |
af8ceeb |
{
|
|
Leigh Scott |
af8ceeb |
- window->should_grab = TRUE;
|
|
Leigh Scott |
af8ceeb |
- window->pretty_xid = 0;
|
|
Leigh Scott |
af8ceeb |
activate_backup_window (window);
|
|
Leigh Scott |
af8ceeb |
}
|
|
Leigh Scott |
af8ceeb |
- else
|
|
Leigh Scott |
af8ceeb |
- {
|
|
Leigh Scott |
af8ceeb |
- g_debug ("Already have new screensaver window, not activating ourselves: 0x%lx", window->pretty_xid);
|
|
Leigh Scott |
af8ceeb |
- }
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
g_mutex_unlock (&pretty_xid_mutex);
|
|
Leigh Scott |
af8ceeb |
}
|
|
Leigh Scott |
af8ceeb |
@@ -550,8 +474,6 @@ setup_window_monitor (BackupWindow *window, gulong xid)
|
|
Leigh Scott |
af8ceeb |
g_debug ("Beginning to monitor screensaver window 0x%lx", xid);
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
g_mutex_lock (&pretty_xid_mutex);
|
|
Leigh Scott |
af8ceeb |
-
|
|
Leigh Scott |
af8ceeb |
- window->should_grab = FALSE;
|
|
Leigh Scott |
af8ceeb |
window->pretty_xid = xid;
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
window_monitor_cancellable = g_cancellable_new ();
|
|
Leigh Scott |
af8ceeb |
@@ -565,24 +487,18 @@ setup_window_monitor (BackupWindow *window, gulong xid)
|
|
Leigh Scott |
af8ceeb |
g_mutex_unlock (&pretty_xid_mutex);
|
|
Leigh Scott |
af8ceeb |
}
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
-static void
|
|
Leigh Scott |
af8ceeb |
-quit (BackupWindow *window)
|
|
Leigh Scott |
af8ceeb |
-{
|
|
Leigh Scott |
af8ceeb |
- g_clear_handle_id (&sigterm_src_id, g_source_remove);
|
|
Leigh Scott |
af8ceeb |
- g_cancellable_cancel (window_monitor_cancellable);
|
|
Leigh Scott |
af8ceeb |
-
|
|
Leigh Scott |
af8ceeb |
- gtk_widget_destroy (GTK_WIDGET (window));
|
|
Leigh Scott |
af8ceeb |
- gtk_main_quit ();
|
|
Leigh Scott |
af8ceeb |
-}
|
|
Leigh Scott |
af8ceeb |
-
|
|
Leigh Scott |
af8ceeb |
static gboolean
|
|
Leigh Scott |
af8ceeb |
sigterm_received (gpointer data)
|
|
Leigh Scott |
af8ceeb |
{
|
|
Leigh Scott |
af8ceeb |
g_debug("SIGTERM received, cleaning up.");
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
- g_return_val_if_fail (BACKUP_IS_WINDOW (data), G_SOURCE_REMOVE);
|
|
Leigh Scott |
af8ceeb |
+ GtkWidget *window = GTK_WIDGET (data);
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
- quit (BACKUP_WINDOW (data));
|
|
Leigh Scott |
af8ceeb |
+ g_clear_handle_id (&sigterm_src_id, g_source_remove);
|
|
Leigh Scott |
af8ceeb |
+ g_cancellable_cancel (window_monitor_cancellable);
|
|
Leigh Scott |
af8ceeb |
+
|
|
Leigh Scott |
af8ceeb |
+ gtk_widget_destroy (window);
|
|
Leigh Scott |
af8ceeb |
+ gtk_main_quit ();
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
return G_SOURCE_REMOVE;
|
|
Leigh Scott |
af8ceeb |
}
|
|
Leigh Scott |
af8ceeb |
@@ -645,13 +561,10 @@ main (int argc,
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
window = backup_window_new (xid);
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
- if (window == NULL)
|
|
Leigh Scott |
af8ceeb |
- {
|
|
Leigh Scott |
af8ceeb |
- g_critical ("No backup window");
|
|
Leigh Scott |
af8ceeb |
- exit(1);
|
|
Leigh Scott |
af8ceeb |
- }
|
|
Leigh Scott |
af8ceeb |
-
|
|
Leigh Scott |
af8ceeb |
sigterm_src_id = g_unix_signal_add (SIGTERM, (GSourceFunc) sigterm_received, window);
|
|
Leigh Scott |
af8ceeb |
+ setup_window_monitor (BACKUP_WINDOW (window), xid);
|
|
Leigh Scott |
af8ceeb |
+
|
|
Leigh Scott |
af8ceeb |
+ gtk_widget_show (window);
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
gtk_main ();
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
diff --git a/libcscreensaver/cs-gdk-event-filter-x11.c b/libcscreensaver/cs-gdk-event-filter-x11.c
|
|
Leigh Scott |
af8ceeb |
index b3ac8bd..f7cf129 100644
|
|
Leigh Scott |
af8ceeb |
--- a/libcscreensaver/cs-gdk-event-filter-x11.c
|
|
Leigh Scott |
af8ceeb |
+++ b/libcscreensaver/cs-gdk-event-filter-x11.c
|
|
Leigh Scott |
af8ceeb |
@@ -147,6 +147,19 @@ restack (CsGdkEventFilter *filter,
|
|
Leigh Scott |
af8ceeb |
|
|
Leigh Scott |
af8ceeb |
XRaiseWindow(GDK_DISPLAY_XDISPLAY (filter->display), filter->my_xid);
|
|
Leigh Scott |
af8ceeb |
}
|
|
Leigh Scott |
af8ceeb |
+ else
|
|
Leigh Scott |
af8ceeb |
+ {
|
|
Leigh Scott |
af8ceeb |
+ g_debug ("BackupWindow received %s from screensaver window (0x%lx), restacking us below it.",
|
|
Leigh Scott |
af8ceeb |
+ event_type,
|
|
Leigh Scott |
af8ceeb |
+ event_window);
|
|
Leigh Scott |
af8ceeb |
+
|
|
Leigh Scott |
af8ceeb |
+ Window windows[] = {
|
|
Leigh Scott |
af8ceeb |
+ filter->pretty_xid,
|
|
Leigh Scott |
af8ceeb |
+ filter->my_xid
|
|
Leigh Scott |
af8ceeb |
+ };
|
|
Leigh Scott |
af8ceeb |
+
|
|
Leigh Scott |
af8ceeb |
+ XRestackWindows (GDK_DISPLAY_XDISPLAY (filter->display), windows, 2);
|
|
Leigh Scott |
af8ceeb |
+ }
|
|
Leigh Scott |
af8ceeb |
}
|
|
Leigh Scott |
af8ceeb |
else
|
|
Leigh Scott |
af8ceeb |
{
|