excerpts from my local tree, part 2

tree 56a7cb0e93f7
parent 12144a441b21
author Tamas TEVESZ <[email protected]> 1230230381 -3600
committer Tamas TEVESZ <[email protected]> 1230230381 -3600
revision 1617
branch ice

Apply http://iain.cx/wm/patches/workspace-xinerama-name/

 The patch has two effects related to the workspace name, which is briefly
 flashed up on the screen when switching workspaces. You can configure where
 the name appears: at the TOP, CENTER, BOTTOM, LEFT, RIGHT or one of the
 four corners of the screen.

 This patch indents the name by 32 pixels from any edges. My personal
 opinion is that it looks better than having the name flush against the
 screen borders.

 The patch also forces the name to be shown entirely within one head of a
 Xinerama display. In stock Window Maker the name will span heads if set to
 TOP, CENTER or BOTTOM alignment, and is hence hard to read when the display
 comprises an even number of heads.
diff --git a/src/workspace.c b/src/workspace.c
--- a/src/workspace.c
+++ b/src/workspace.c
@@ -281,6 +281,11 @@
     char *name = scr->workspaces[workspace]->name;
     int len = strlen(name);
     int x, y;
+#ifdef XINERAMA
+    int head;
+    WMRect rect;
+    int xx, yy;
+#endif
 
     if (wPreferences.workspace_name_display_position == WD_NONE ||
         scr->workspace_count < 2) {
@@ -307,35 +312,61 @@
     w = WMWidthOfString(scr->workspace_name_font, name, len);
     h = WMFontHeight(scr->workspace_name_font);
 
+#ifdef XINERAMA
+    head = wGetHeadForPointerLocation(scr);
+    rect = wGetRectForHead(scr, head);
+    if (scr->xine_info.count) {
+        xx = rect.pos.x + (scr->xine_info.screens[head].size.width - (w+4))/2;
+        yy = rect.pos.y + (scr->xine_info.screens[head].size.height - (h+4))/2;
+    }
+    else {
+        xx = (scr->scr_width - (w+4))/2;
+        yy = (scr->scr_height - (h+4))/2;
+    }
+#endif
+
     switch (wPreferences.workspace_name_display_position) {
     case WD_TOP:
+#ifdef XINERAMA
+        px = xx;
+#else
         px = (scr->scr_width - (w+4))/2;
-        py = 0;
+#endif
+        py = 32;
         break;
     case WD_BOTTOM:
+#ifdef XINERAMA
+        px = xx;
+#else
         px = (scr->scr_width - (w+4))/2;
-        py = scr->scr_height - (h+4);
+#endif
+        py = scr->scr_height - (h+36);
         break;
     case WD_TOPLEFT:
-        px = 0;
-        py = 0;
+        px = 32;
+        py = 32;
         break;
     case WD_TOPRIGHT:
-        px = scr->scr_width - (w+4);
-        py = 0;
+        px = scr->scr_width - (w+36);
+        py = 32;
         break;
     case WD_BOTTOMLEFT:
-        px = 0;
-        py = scr->scr_height - (h+4);
+        px = 32;
+        py = scr->scr_height - (h+36);
         break;
     case WD_BOTTOMRIGHT:
-        px = scr->scr_width - (w+4);
-        py = scr->scr_height - (h+4);
+        px = scr->scr_width - (w+36);
+        py = scr->scr_height - (h+36);
         break;
     case WD_CENTER:
     default:
-        px = (scr->scr_width - (w+4))/2;
-        py = (scr->scr_height - (h+4))/2;
+#ifdef XINERAMA
+        px = xx;
+        py = yy;
+#else
+        px = (scr->scr_width - (w+36))/2;
+        py = (scr->scr_height - (h+36))/2;
+#endif
         break;
     }
     XResizeWindow(dpy, scr->workspace_name, w+4, h+4);

-- 
[-]

mkdir /nonexistent


-- 
To unsubscribe, send mail to [email protected].

Reply via email to