xfdesktop: dealing with (fullscreen) low-res apps that screw up icon placement

Adam Glover masato529 at gmail.com
Mon Dec 21 05:55:50 CET 2009


I've noticed that the normal behavior of xfdesktop is not ideal
for all situations.

The problem in this case is that some applications which run in
fullscreen, have a set resoution (or just lower maximum) than I run
on my monitor.  This causes any arrangement of icons to get messed
up as soon as the app resizes the screen.

I could find no way to deal with this behavior so I modified xfdesktop.
Was this necessary or is there some possible configuration I missed?
(or is this already being dealt with in a develpment branch?)

I am including my changes against xfdesktop4-4.6.1 so devs can get
an idea as to what I did and perhaps comment on it.  If my changes
seem bizarre, I apologize (I'm not terribly experienced with real coding)
but it should give you an idea as to what I'd like to see in the program.

I just set up an option that would cancel responses to desktop resizing
and would be able to toggle it in a running instance.  It suits my needs
but I don't know if there's a possiblity of having messed anything else
up.

Comments and suggestions are quite welcome.

Thanks
Adam Glover

--- xfdesktop4-4.6.1.orig/common/xfdesktop-common.h	2009-12-19
14:01:05.000000000 -0800
+++ xfdesktop4-4.6.1/common/xfdesktop-common.h	2009-12-19
15:54:17.000000000 -0800
@@ -37,6 +37,7 @@
 #define DEFAULT_ICON_SIZE        32

 #define LIST_TEXT                "# xfce backdrop list"
+
 #define XFDESKTOP_SELECTION_FMT  "XFDESKTOP_SELECTION_%d"
 #define XFDESKTOP_IMAGE_FILE_FMT "XFDESKTOP_IMAGE_FILE_%d"

@@ -44,6 +45,8 @@
 #define MENU_MESSAGE       "menu"
 #define WINDOWLIST_MESSAGE "windowlist"
 #define QUIT_MESSAGE       "quit"
+#define RESIZE_MESSAGE     "resizeyes"
+#define NORESIZE_MESSAGE   "resizeno"

 G_BEGIN_DECLS

--- xfdesktop4-4.6.1.orig/src/main.c	2009-12-19 14:01:05.000000000 -0800
+++ xfdesktop4-4.6.1/src/main.c	2009-12-19 15:54:17.000000000 -0800
@@ -62,6 +62,7 @@

 static SessionClient *client_session = NULL;
 static gboolean is_session_managed = FALSE;
+gboolean xfdesktop_noresize = FALSE;

 static void
 session_logout(void)
@@ -188,6 +189,12 @@
             }
             gtk_main_quit();
             return TRUE;
+        } else if(!strcmp(RESIZE_MESSAGE, evt->data.b)) {
+            xfdesktop_noresize = FALSE;
+            return TRUE;
+        } else if(!strcmp(NORESIZE_MESSAGE, evt->data.b)) {
+            xfdesktop_noresize = TRUE;
+            return TRUE;
         }
     }

@@ -224,6 +231,7 @@
     gboolean already_running;
     gchar buf[1024];
     GError *error = NULL;
+    gboolean grid_message = FALSE;

     /* bind gettext textdomain */
     xfce_textdomain(GETTEXT_PACKAGE, LOCALEDIR, "UTF-8");
@@ -286,6 +294,13 @@
             message = QUIT_MESSAGE;
         else if(!strcmp("--sm-client-id", argv[1])) {
             /* do nothing */
+        } else if(!strcmp("-resize", argument)) {
+            message = RESIZE_MESSAGE;
+            grid_message = TRUE;
+        } else if(!strcmp("-noresize", argument)) {
+            message = NORESIZE_MESSAGE;
+            xfdesktop_noresize = TRUE;
+            grid_message = TRUE;
         } else {
             g_printerr(_("%s: Unknown option: %s\n"), PACKAGE, argv[1]);
             g_printerr(_("Options are:\n"));
@@ -311,6 +326,16 @@

     g_print("%s[%d]: starting up\n", PACKAGE, getpid());

+    /* If resize/noresize was passed, send message if already running.
+    Otherwise, just clear message as we're not doing anything with it */
+    if(grid_message) {
+        if(already_running) {
+            xfdesktop_send_client_message(xid, message);
+            return 0;
+        }
+        message = NULL;
+    }
+
     if(message) {
         if(!already_running)
             g_printerr(_("%s is not running.\n"), PACKAGE);
--- xfdesktop4-4.6.1.orig/src/xfdesktop-icon-view.c	2009-12-19
14:01:05.000000000 -0800
+++ xfdesktop4-4.6.1/src/xfdesktop-icon-view.c	2009-12-19
16:02:53.000000000 -0800
@@ -2299,6 +2299,9 @@
 static void
 xfdesktop_grid_do_resize(XfdesktopIconView *icon_view)
 {
+    /* If we disabled resizing, short-circuit the whole thing. */
+    if(xfdesktop_noresize) return;
+
     GList *l, *leftovers = NULL;

     /* move all icons into the pending_icons list */
--- xfdesktop4-4.6.1.orig/src/xfdesktop-icon-view.h	2009-12-19
14:01:05.000000000 -0800
+++ xfdesktop4-4.6.1/src/xfdesktop-icon-view.h	2009-12-19
16:00:01.000000000 -0800
@@ -56,6 +56,8 @@
     void (*icon_activated)(XfdesktopIconView *icon_view);
 };

+extern gboolean xfdesktop_noresize;
+
 GType xfdesktop_icon_view_get_type() G_GNUC_CONST;

 GtkWidget *xfdesktop_icon_view_new(XfdesktopIconViewManager *manager);
Only in xfdesktop4: xfdesktop.spec



More information about the Xfce4-dev mailing list