Ticket #46717: xfwm4-stacking4nonX11.patch
File xfwm4-stacking4nonX11.patch, 5.9 KB (added by RJVB (René Bertin), 10 years ago) |
---|
-
src/screen.h
diff --git a/src/screen.h b/src/screen.h index 668c932..e4206d2 100644
a b struct _ScreenInfo 179 179 180 180 guint compositor_timeout_id; 181 181 #endif /* HAVE_COMPOSITOR */ 182 Window last_raise_sibling; 182 183 }; 183 184 184 185 gboolean myScreenCheckWMAtom (ScreenInfo *, -
src/stacking.c
diff --git a/src/stacking.c b/src/stacking.c index a2a0e71..22b9cea 100644
a b 43 43 static guint raise_timeout = 0; 44 44 45 45 void 46 clientApplyStackList (ScreenInfo *screen_info )46 clientApplyStackList (ScreenInfo *screen_info, Client *client, StackingAction action ) 47 47 { 48 48 Window *xwinstack; 49 49 guint nwindows; 50 50 gint i; 51 51 52 DBG ("applying stack list ");52 DBG ("applying stack list, action=%s on window 0x%lx", (action==Raise)? "Raise" : ((action==Lower)? "Lower" : "Restack"), client->window ); 53 53 nwindows = g_list_length (screen_info->windows_stack); 54 54 55 55 i = 0; … … clientApplyStackList (ScreenInfo *screen_info) 68 68 { 69 69 c = (Client *) index->data; 70 70 xwinstack[i++] = c->frame; 71 DBG (" [%i] \"%s\" (0x%lx)", i, c->name, c->window); 71 if ( !((action==Raise || action==Lower) && c->window!=client->window) ) 72 { 73 DBG (" [%i] \"%s\" (0x%lx)", i, c->name, c->window); 74 } 72 75 } 73 76 } 74 77 75 XRestackWindows (myScreenGetXDisplay (screen_info), xwinstack, (int) nwindows + 4); 78 switch (action) 79 { 80 case Restack: 81 default: 82 // Restack the windows. This is the preferred action if the lowering/raising has to be done with respect to 83 // a sibling window. 84 XRestackWindows (myScreenGetXDisplay (screen_info), xwinstack, (int) nwindows + 4); 85 break; 86 case Raise: 87 // Raise the windows inconditionally, working backwards (xwinstack[n-1] .. xwinstack[0]) as RestackWindows would do too. 88 // This is the preferred action when raising a window on Mac OS X or MS Windows when the X server does not 89 // manage all windows on the screen. Using Restack, the window would remain behind non X windows if it was 90 // not already in front of them. 91 for (i = nwindows ; i >= 0 ; --i) 92 { 93 if (xwinstack[i] == client->frame || i <= 3) 94 { 95 XRaiseWindow (myScreenGetXDisplay (screen_info), xwinstack[i]); 96 } 97 } 98 break; 99 case Lower: 100 // Lower the windows inconditionally, (xwinstack[0] .. xwinstack[n-1]). 101 // This is the preferred action when lowering a window on Mac OS X or MS Windows when the X server does not 102 // manage all windows on the screen. Using Restack, the window would remain in front of non X windows if it was 103 // not already behind them. 104 for (i = 0 ; i < nwindows ; ++i) 105 { 106 if (xwinstack[i] == client->frame || i <= 3) 107 { 108 XLowerWindow (myScreenGetXDisplay (screen_info), xwinstack[i]); 109 } 110 } 111 break; 112 } 76 113 77 114 g_free (xwinstack); 78 115 } … … clientRaise (Client * c, Window wsibling) 297 334 transients = NULL; 298 335 sibling = NULL; 299 336 300 if (c == screen_info->last_raise )337 if (c == screen_info->last_raise && (wsibling && wsibling == screen_info->last_raise_sibling)) 301 338 { 302 TRACE ("client \"%s\" (0x%lx) already raised ", c->name, c->window);339 TRACE ("client \"%s\" (0x%lx) already raised w.r.t. sibling %lx", c->name, c->window, wsibling); 303 340 return; 304 341 } 305 342 TRACE ("raising client \"%s\" (0x%lx) over (0x%lx)", c->name, c->window, wsibling); … … clientRaise (Client * c, Window wsibling) 438 475 } 439 476 /* Now, screen_info->windows_stack contains the correct window stack 440 477 We still need to tell the X Server to reflect the changes 478 This is done using XRestackWindows when we're restacking w.r.t. wsibling, and using XRaiseWindow otherwise. 441 479 */ 442 clientApplyStackList (screen_info );480 clientApplyStackList (screen_info, (wsibling)? Restack : Raise); 443 481 clientSetNetClientList (c->screen_info, display_info->atoms[NET_CLIENT_LIST_STACKING], screen_info->windows_stack); 444 482 screen_info->last_raise = c; 483 screen_info->last_raise_sibling = wsibling; 445 484 } 446 485 } 447 486 … … clientLower (Client * c, Window wsibling) 527 566 } 528 567 /* Now, screen_info->windows_stack contains the correct window stack 529 568 We still need to tell the X Server to reflect the changes 569 This is done using XRestackWindows when we're restacking w.r.t. wsibling, and using XLowerWindow otherwise. 530 570 */ 531 clientApplyStackList (screen_info );571 clientApplyStackList (screen_info, (wsibling)? Restack : Lower); 532 572 clientSetNetClientList (screen_info, display_info->atoms[NET_CLIENT_LIST_STACKING], screen_info->windows_stack); 533 573 clientPassGrabMouseButton (NULL); 534 574 clientPassFocus (screen_info, c, NULL); 535 575 if (screen_info->last_raise == c) 536 576 { 537 577 screen_info->last_raise = NULL; 578 screen_info->last_raise_sibling = 0; 538 579 } 539 580 } 540 581 } -
src/stacking.h
diff --git a/src/stacking.h b/src/stacking.h index c65b92d..f7cc19c 100644
a b 31 31 #include "screen.h" 32 32 #include "client.h" 33 33 34 void clientApplyStackList (ScreenInfo *); 34 typedef enum StackingAction {Restack, Raise, Lower} StackingAction; 35 36 void clientApplyStackList (ScreenInfo *, Client *, StackingAction); 35 37 Client *clientGetLowestTransient (Client *); 36 38 Client *clientGetHighestTransientOrModalFor (Client *); 37 39 gboolean clientIsTopMost (Client *);