From af857e8b95d56919acbe245aa3fec55daa2f2a9c Mon Sep 17 00:00:00 2001 From: Tamas TEVESZ Date: Sun, 10 Apr 2011 16:35:02 +0200 Subject: [PATCH] Fix app behaviour on Xinerama displays With Xinerama, on heads other than the primary, certain parts (menus, scrollbars) of certain types of clients (Qt) are incorrectly or not at all drawn. The fix follows other window managers in completely ignoring the _NET_WORKAREA property. Problem originally poked at by Ambrus Szabo, correct keyword and the eventually implemented solution suggested by Lucius Windschuh, typed up by me. --- src/screen.c | 48 +++++++++++++++++++++--------------------------- src/wmspec.c | 29 ----------------------------- 2 files changed, 21 insertions(+), 56 deletions(-) diff --git a/src/screen.c b/src/screen.c index 782ea1e6..e2cda33b 100644 --- a/src/screen.c +++ b/src/screen.c @@ -795,10 +795,15 @@ void wScreenUpdateUsableArea(WScreen * scr) * border. */ - int i; - unsigned long best_area = 0, tmp_area; WArea area; - int dock_head = scr->xine_info.primary_head; + int i, dock_head; + unsigned long best_area, tmp_area; + unsigned int size, position; + + dock_head = scr->xine_info.primary_head; + best_area = 0; + size = wPreferences.workspace_border_size; + position = wPreferences.workspace_border_position; if (scr->dock) { WMRect rect; @@ -826,14 +831,11 @@ void wScreenUpdateUsableArea(WScreen * scr) } } - { - WArea area; - if (wNETWMGetUsableArea(scr, i, &area)) { - scr->totalUsableArea[i].x1 = WMAX(scr->totalUsableArea[i].x1, area.x1); - scr->totalUsableArea[i].y1 = WMAX(scr->totalUsableArea[i].y1, area.y1); - scr->totalUsableArea[i].x2 = WMIN(scr->totalUsableArea[i].x2, area.x2); - scr->totalUsableArea[i].y2 = WMIN(scr->totalUsableArea[i].y2, area.y2); - } + if (wNETWMGetUsableArea(scr, i, &area)) { + scr->totalUsableArea[i].x1 = WMAX(scr->totalUsableArea[i].x1, area.x1); + scr->totalUsableArea[i].y1 = WMAX(scr->totalUsableArea[i].y1, area.y1); + scr->totalUsableArea[i].x2 = WMIN(scr->totalUsableArea[i].x2, area.x2); + scr->totalUsableArea[i].y2 = WMIN(scr->totalUsableArea[i].y2, area.y2); } scr->usableArea[i] = scr->totalUsableArea[i]; @@ -842,7 +844,6 @@ void wScreenUpdateUsableArea(WScreen * scr) printf("usableArea[%d]: %d %d %d %d\n", i, scr->usableArea[i].x1, scr->usableArea[i].x2, scr->usableArea[i].y1, scr->usableArea[i].y2); #endif - if (wPreferences.no_window_over_icons) { if (wPreferences.icon_yard & IY_VERT) { if (wPreferences.icon_yard & IY_RIGHT) { @@ -877,25 +878,18 @@ void wScreenUpdateUsableArea(WScreen * scr) area = scr->totalUsableArea[i]; } - { - unsigned size = wPreferences.workspace_border_size; - unsigned position = wPreferences.workspace_border_position; - - if (size > 0 && position != WB_NONE) { - if (position & WB_LEFTRIGHT) { - scr->totalUsableArea[i].x1 += size; - scr->totalUsableArea[i].x2 -= size; - } - if (position & WB_TOPBOTTOM) { - scr->totalUsableArea[i].y1 += size; - scr->totalUsableArea[i].y2 -= size; - } + if (size > 0 && position != WB_NONE) { + if (position & WB_LEFTRIGHT) { + scr->totalUsableArea[i].x1 += size; + scr->totalUsableArea[i].x2 -= size; + } + if (position & WB_TOPBOTTOM) { + scr->totalUsableArea[i].y1 += size; + scr->totalUsableArea[i].y2 -= size; } } } - wNETWMUpdateWorkarea(scr, area); - if (wPreferences.auto_arrange_icons) wArrangeIcons(scr, True); } diff --git a/src/wmspec.c b/src/wmspec.c index d166d289..d3bce77c 100644 --- a/src/wmspec.c +++ b/src/wmspec.c @@ -68,7 +68,6 @@ static Atom net_desktop_viewport; static Atom net_current_desktop; static Atom net_desktop_names; static Atom net_active_window; -static Atom net_workarea; /* XXX: not xinerama compatible */ static Atom net_supporting_wm_check; static Atom net_virtual_roots; /* N/A */ static Atom net_desktop_layout; /* XXX */ @@ -144,7 +143,6 @@ static atomitem_t atomNames[] = { {"_NET_CURRENT_DESKTOP", &net_current_desktop}, {"_NET_DESKTOP_NAMES", &net_desktop_names}, {"_NET_ACTIVE_WINDOW", &net_active_window}, - {"_NET_WORKAREA", &net_workarea}, {"_NET_SUPPORTING_WM_CHECK", &net_supporting_wm_check}, {"_NET_VIRTUAL_ROOTS", &net_virtual_roots}, {"_NET_DESKTOP_LAYOUT", &net_desktop_layout}, @@ -253,7 +251,6 @@ static void setSupportedHints(WScreen * scr) atom[i++] = net_current_desktop; atom[i++] = net_desktop_names; atom[i++] = net_active_window; - atom[i++] = net_workarea; atom[i++] = net_supporting_wm_check; atom[i++] = net_showing_desktop; #if 0 @@ -629,32 +626,6 @@ void wNETWMUpdateActions(WWindow * wwin, Bool del) XA_ATOM, 32, PropModeReplace, (unsigned char *)action, i); } -void wNETWMUpdateWorkarea(WScreen * scr, WArea usableArea) -{ - long *area; - int count, i; - - /* XXX: not Xinerama compatible, - xinerama gets the largest available */ - - if (!scr->netdata || scr->workspace_count == 0) - return; - - count = scr->workspace_count * 4; - area = wmalloc(sizeof(long) * count); - for (i = 0; i < scr->workspace_count; i++) { - area[4 * i + 0] = usableArea.x1; - area[4 * i + 1] = usableArea.y1; - area[4 * i + 2] = usableArea.x2 - usableArea.x1; - area[4 * i + 3] = usableArea.y2 - usableArea.y1; - } - - XChangeProperty(dpy, scr->root_win, net_workarea, XA_CARDINAL, 32, - PropModeReplace, (unsigned char *)area, count); - - wfree(area); -} - Bool wNETWMGetUsableArea(WScreen * scr, int head, WArea * area) { WReservedArea *cur;