summaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc115
1 files changed, 50 insertions, 65 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 2823fdd..0fca281 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Window.cc,v 1.53 2002/05/19 17:56:55 fluxgen Exp $ 25// $Id: Window.cc,v 1.54 2002/05/21 21:22:05 fluxgen Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -207,37 +207,8 @@ tab(0)
207 fluxbox->saveWindowSearch(client.window, this); 207 fluxbox->saveWindowSearch(client.window, this);
208 208
209 // determine if this is a transient window 209 // determine if this is a transient window
210 Window win; 210 checkTransient();
211 if (XGetTransientForHint(display, client.window, &win)) { 211
212 if (win && (win != client.window)) {
213 FluxboxWindow *tr;
214 if ((tr = fluxbox->searchWindow(win))) {
215
216 while (tr->client.transient)
217 tr = tr->client.transient;
218
219 client.transient_for = tr;
220 tr->client.transient = this;
221 stuck = client.transient_for->stuck;
222 transient = true;
223 } else if (win == client.window_group) {
224 if ((tr = fluxbox->searchGroup(win, this))) {
225
226 while (tr->client.transient)
227 tr = tr->client.transient;
228
229 client.transient_for = tr;
230 tr->client.transient = this;
231 stuck = client.transient_for->stuck;
232 transient = true;
233 }
234 }
235 }
236
237 if (win == screen->getRootWindow())
238 modal = true;
239 }
240
241 // adjust the window decorations based on transience and window sizes 212 // adjust the window decorations based on transience and window sizes
242 if (transient) { 213 if (transient) {
243 decorations.maximize = functions.maximize = false; 214 decorations.maximize = functions.maximize = false;
@@ -407,8 +378,8 @@ FluxboxWindow::~FluxboxWindow(void) {
407 client.blackbox_hint = 0; 378 client.blackbox_hint = 0;
408 } 379 }
409 380
410 381
411 if (client.transient_for!=0) { 382 if (isTransient()) {
412 //guard from having transient_for = this 383 //guard from having transient_for = this
413 if (client.transient_for == this) { 384 if (client.transient_for == this) {
414 #ifdef DEBUG 385 #ifdef DEBUG
@@ -419,7 +390,7 @@ FluxboxWindow::~FluxboxWindow(void) {
419 390
420 fluxbox->setFocusedWindow(client.transient_for); 391 fluxbox->setFocusedWindow(client.transient_for);
421 } 392 }
422 393
423 if (client.window_group) { 394 if (client.window_group) {
424 fluxbox->removeGroupSearch(client.window_group); 395 fluxbox->removeGroupSearch(client.window_group);
425 client.window_group = 0; 396 client.window_group = 0;
@@ -1705,7 +1676,7 @@ void FluxboxWindow::configure(int dx, int dy,
1705 1676
1706 downsize(); 1677 downsize();
1707 1678
1708#ifdef SHAPE 1679#ifdef SHAPE
1709 if (Fluxbox::instance()->hasShapeExtensions() && frame.shaped) { 1680 if (Fluxbox::instance()->hasShapeExtensions() && frame.shaped) {
1710 XShapeCombineShape(display, frame.window, ShapeBounding, 1681 XShapeCombineShape(display, frame.window, ShapeBounding,
1711 frame.mwm_border_w, frame.y_border + 1682 frame.mwm_border_w, frame.y_border +
@@ -1811,15 +1782,14 @@ bool FluxboxWindow::setInputFocus(void) {
1811 bool ret = false; 1782 bool ret = false;
1812 1783
1813 if (client.transient && modal) 1784 if (client.transient && modal)
1814 ret = client.transient->setInputFocus(); 1785 return client.transient->setInputFocus();
1815 else { 1786 else {
1816 if (! focused) { 1787 if (! focused) {
1817 if (focus_mode == F_LOCALLYACTIVE || focus_mode == F_PASSIVE) 1788 if (focus_mode == F_LOCALLYACTIVE || focus_mode == F_PASSIVE)
1818 XSetInputFocus(display, client.window, 1789 XSetInputFocus(display, client.window,
1819 RevertToPointerRoot, CurrentTime); 1790 RevertToPointerRoot, CurrentTime);
1820 else 1791 else
1821 XSetInputFocus(display, screen->getRootWindow(), 1792 return false;
1822 RevertToNone, CurrentTime);
1823 1793
1824 fluxbox->setFocusedWindow(this); 1794 fluxbox->setFocusedWindow(this);
1825 1795
@@ -2877,7 +2847,7 @@ bool FluxboxWindow::unmapNotifyEvent(XUnmapEvent *ue) {
2877bool FluxboxWindow::destroyNotifyEvent(XDestroyWindowEvent *de) { 2847bool FluxboxWindow::destroyNotifyEvent(XDestroyWindowEvent *de) {
2878 if (de->window == client.window) { 2848 if (de->window == client.window) {
2879 #ifdef DEBUG 2849 #ifdef DEBUG
2880 cerr<<__FILE__<<"("<<__LINE__<<":) DestroyNotifyEvent this="<<this<<endl; 2850 cerr<<__FILE__<<"("<<__LINE__<<"): DestroyNotifyEvent this="<<this<<endl;
2881 #endif 2851 #endif
2882 XUnmapWindow(display, frame.window); 2852 XUnmapWindow(display, frame.window);
2883 return true; 2853 return true;
@@ -2899,31 +2869,7 @@ void FluxboxWindow::propertyNotifyEvent(Atom atom) {
2899 break; 2869 break;
2900 2870
2901 case XA_WM_TRANSIENT_FOR: 2871 case XA_WM_TRANSIENT_FOR:
2902 // determine if this is a transient window 2872 checkTransient();
2903 Window win;
2904 if (XGetTransientForHint(display, client.window, &win)) {
2905 if (win && (win != client.window))
2906 if ((client.transient_for = fluxbox->searchWindow(win))) {
2907 client.transient_for->client.transient = this;
2908 stuck = client.transient_for->stuck;
2909 transient = true;
2910 } else if (win == client.window_group) {
2911 //jr This doesn't look quite right...
2912 if ((client.transient_for = fluxbox->searchGroup(win, this))) {
2913 client.transient_for->client.transient = this;
2914 stuck = client.transient_for->stuck;
2915 transient = true;
2916 }
2917 }
2918
2919 if (win == screen->getRootWindow()) modal = true;
2920 }
2921
2922 // adjust the window decorations based on transience
2923 if (transient)
2924 decorations.maximize = decorations.handle =
2925 decorations.border = functions.maximize = false;
2926
2927 reconfigure(); 2873 reconfigure();
2928 2874
2929 break; 2875 break;
@@ -3482,6 +3428,7 @@ void FluxboxWindow::toggleDecoration() {
3482 decor = false; 3428 decor = false;
3483 } 3429 }
3484} 3430}
3431
3485bool FluxboxWindow::validateClient(void) { 3432bool FluxboxWindow::validateClient(void) {
3486 XSync(display, false); 3433 XSync(display, false);
3487 3434
@@ -3730,6 +3677,44 @@ void FluxboxWindow::destroyHandle() {
3730 3677
3731} 3678}
3732 3679
3680void FluxboxWindow::checkTransient() {
3681 Fluxbox *fluxbox = Fluxbox::instance();
3682 // determine if this is a transient window
3683 Window win;
3684 if (!XGetTransientForHint(display, client.window, &win)) {
3685 client.transient_for = 0;
3686 return;
3687 }
3688 if (win && (win != client.window)) {
3689 FluxboxWindow *tr;
3690 if ((tr = fluxbox->searchWindow(win))) {
3691
3692 while (tr->client.transient)
3693 tr = tr->client.transient;
3694
3695 client.transient_for = tr;
3696 tr->client.transient = this;
3697 stuck = client.transient_for->stuck;
3698 transient = true;
3699 } else if (win == client.window_group) {
3700 if ((tr = fluxbox->searchGroup(win, this))) {
3701
3702 while (tr->client.transient)
3703 tr = tr->client.transient;
3704
3705 client.transient_for = tr;
3706 tr->client.transient = this;
3707 stuck = client.transient_for->stuck;
3708 transient = true;
3709 }
3710 }
3711 }
3712
3713 if (win == screen->getRootWindow())
3714 modal = true;
3715
3716}
3717
3733void FluxboxWindow::restore(void) { 3718void FluxboxWindow::restore(void) {
3734 XChangeSaveSet(display, client.window, SetModeDelete); 3719 XChangeSaveSet(display, client.window, SetModeDelete);
3735 XSelectInput(display, client.window, NoEventMask); 3720 XSelectInput(display, client.window, NoEventMask);