aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-02-16 11:25:41 (GMT)
committerfluxgen <fluxgen>2002-02-16 11:25:41 (GMT)
commit5f39282ce6aa5b4b784d45d134ad9d7908ad2cee (patch)
treed79b7f247cbff19f0cdc0100edd838bc9e636db8 /src/Window.cc
parent59761a0f2521d4e9deca41d42caf24f9433378c7 (diff)
downloadfluxbox_pavel-5f39282ce6aa5b4b784d45d134ad9d7908ad2cee.zip
fluxbox_pavel-5f39282ce6aa5b4b784d45d134ad9d7908ad2cee.tar.bz2
fixed unmapNotifyEvent to return a value instead of suicide
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc100
1 files changed, 56 insertions, 44 deletions
diff --git a/src/Window.cc b/src/Window.cc
index a85502b..c4e211e 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.27 2002/02/16 02:14:54 pekdon Exp $ 25// $Id: Window.cc,v 1.28 2002/02/16 11:25:41 fluxgen Exp $
26 26
27//use GNU extensions 27//use GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -172,7 +172,6 @@ tab(0)
172 if (!screen) 172 if (!screen)
173 return; 173 return;
174 174
175
176 image_ctrl = screen->getImageControl(); 175 image_ctrl = screen->getImageControl();
177 176
178 client.x = wattrib.x; 177 client.x = wattrib.x;
@@ -331,29 +330,7 @@ tab(0)
331 330
332 associateClientWindow(); 331 associateClientWindow();
333 332
334 333 grabButtons();
335 XGrabButton(display, Button1, AnyModifier,
336 frame.plate, True, ButtonPressMask,
337 GrabModeSync, GrabModeSync, None, None);
338 XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask, frame.plate);
339
340
341 XGrabButton(display, Button1, Mod1Mask, frame.window, True,
342 ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
343 GrabModeAsync, None, fluxbox->getMoveCursor());
344
345 //----grab with "all" modifiers
346 grabButton(display, Button1, frame.window, fluxbox->getMoveCursor());
347
348 XGrabButton(display, Button2, Mod1Mask, frame.window, True,
349 ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None);
350
351 XGrabButton(display, Button3, Mod1Mask, frame.window, True,
352 ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
353 GrabModeAsync, None, fluxbox->getLowerRightAngleCursor());
354
355 //---grab with "all" modifiers
356 grabButton(display, Button3, frame.window, fluxbox->getLowerRightAngleCursor());
357 334
358 positionWindows(); 335 positionWindows();
359 336
@@ -406,8 +383,11 @@ tab(0)
406 383
407 384
408FluxboxWindow::~FluxboxWindow(void) { 385FluxboxWindow::~FluxboxWindow(void) {
386 if (screen==0) //the window wasn't created
387 return;
388
409 #ifdef GNOME 389 #ifdef GNOME
410 XDeleteProperty (display, client.window, screen->getBaseDisplay()->getGnomeWorkspaceAtom()); 390 XDeleteProperty(display, client.window, screen->getBaseDisplay()->getGnomeWorkspaceAtom());
411 #endif 391 #endif
412 392
413 Fluxbox *fluxbox = Fluxbox::instance(); 393 Fluxbox *fluxbox = Fluxbox::instance();
@@ -850,6 +830,32 @@ void FluxboxWindow::decorateLabel(void) {
850 if (tmp) image_ctrl->removeImage(tmp); 830 if (tmp) image_ctrl->removeImage(tmp);
851} 831}
852 832
833void FluxboxWindow::grabButtons() {
834 Fluxbox *fluxbox = Fluxbox::instance();
835
836 XGrabButton(display, Button1, AnyModifier,
837 frame.plate, True, ButtonPressMask,
838 GrabModeSync, GrabModeSync, None, None);
839 XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask, frame.plate);
840
841
842 XGrabButton(display, Button1, Mod1Mask, frame.window, True,
843 ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
844 GrabModeAsync, None, fluxbox->getMoveCursor());
845
846 //----grab with "all" modifiers
847 grabButton(display, Button1, frame.window, fluxbox->getMoveCursor());
848
849 XGrabButton(display, Button2, Mod1Mask, frame.window, True,
850 ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None);
851
852 XGrabButton(display, Button3, Mod1Mask, frame.window, True,
853 ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
854 GrabModeAsync, None, fluxbox->getLowerRightAngleCursor());
855
856 //---grab with "all" modifiers
857 grabButton(display, Button3, frame.window, fluxbox->getLowerRightAngleCursor());
858}
853void FluxboxWindow::createButton(int type, ButtonEventProc pressed, ButtonEventProc released, ButtonDrawProc draw) { 859void FluxboxWindow::createButton(int type, ButtonEventProc pressed, ButtonEventProc released, ButtonDrawProc draw) {
854 Button b; 860 Button b;
855 b.win = createChildWindow(frame.title); 861 b.win = createChildWindow(frame.title);
@@ -883,13 +889,13 @@ long FluxboxWindow::getGnomeWindowState() {
883 if (isShaded()) 889 if (isShaded())
884 state |= BaseDisplay::WIN_STATE_SHADED; 890 state |= BaseDisplay::WIN_STATE_SHADED;
885 /*TODO: states: 891 /*TODO: states:
886 WIN_STATE_MAXIMIZED_VERT = (1<<2), // window in maximized V state 892 WIN_STATE_MAXIMIZED_VERT // window in maximized V state
887 WIN_STATE_MAXIMIZED_HORIZ = (1<<3), // window in maximized H state 893 WIN_STATE_MAXIMIZED_HORIZ // window in maximized H state
888 WIN_STATE_HIDDEN = (1<<4), // not on taskbar but window visible 894 WIN_STATE_HIDDEN // not on taskbar but window visible
889 WIN_STATE_HID_WORKSPACE = (1<<6), // not on current desktop 895 WIN_STATE_HID_WORKSPACE // not on current desktop
890 WIN_STATE_HID_TRANSIENT = (1<<7), // owner of transient is hidden 896 WIN_STATE_HID_TRANSIENT // owner of transient is hidden
891 WIN_STATE_FIXED_POSITION = (1<<8), // window is fixed in position even 897 WIN_STATE_FIXED_POSITION // window is fixed in position even
892 WIN_STATE_ARRANGE_IGNORE = (1<<9) // ignore for auto arranging 898 WIN_STATE_ARRANGE_IGNORE // ignore for auto arranging
893 */ 899 */
894 return state; 900 return state;
895} 901}
@@ -1417,7 +1423,7 @@ void FluxboxWindow::getWMNormalHints(void) {
1417 client.max_aspect_y = sizehint.max_aspect.y; 1423 client.max_aspect_y = sizehint.max_aspect.y;
1418 } else 1424 } else
1419 client.min_aspect_x = client.min_aspect_y = 1425 client.min_aspect_x = client.min_aspect_y =
1420 client.max_aspect_x = client.max_aspect_y = 1; 1426 client.max_aspect_x = client.max_aspect_y = 1;
1421 1427
1422 if (sizehint.flags & PBaseSize) { 1428 if (sizehint.flags & PBaseSize) {
1423 client.base_width = sizehint.base_width; 1429 client.base_width = sizehint.base_width;
@@ -1753,7 +1759,6 @@ void FluxboxWindow::setTab(bool flag) {
1753//-------------------------------------- 1759//--------------------------------------
1754void FluxboxWindow::iconify(void) { 1760void FluxboxWindow::iconify(void) {
1755 1761
1756
1757 if (iconic) 1762 if (iconic)
1758 return; 1763 return;
1759 1764
@@ -2580,8 +2585,13 @@ void FluxboxWindow::mapNotifyEvent(XMapEvent *ne) {
2580 } 2585 }
2581} 2586}
2582 2587
2583 2588//------------------- unmapNotify ------------------
2584void FluxboxWindow::unmapNotifyEvent(XUnmapEvent *ue) { 2589// Unmaps frame window and client window if
2590// event.window == client.window
2591// Returns true if *this should die
2592// else false
2593//-------------------------------------------------
2594bool FluxboxWindow::unmapNotifyEvent(XUnmapEvent *ue) {
2585 if (ue->window == client.window) { 2595 if (ue->window == client.window) {
2586 #ifdef DEBUG 2596 #ifdef DEBUG
2587 fprintf(stderr, 2597 fprintf(stderr,
@@ -2599,7 +2609,7 @@ void FluxboxWindow::unmapNotifyEvent(XUnmapEvent *ue) {
2599 BaseDisplay::GrabGuard gg(*fluxbox); 2609 BaseDisplay::GrabGuard gg(*fluxbox);
2600 fluxbox->grab(); 2610 fluxbox->grab();
2601 if (! validateClient()) 2611 if (! validateClient())
2602 return; 2612 return false;
2603 2613
2604 XChangeSaveSet(display, client.window, SetModeDelete); 2614 XChangeSaveSet(display, client.window, SetModeDelete);
2605 XSelectInput(display, client.window, NoEventMask); 2615 XSelectInput(display, client.window, NoEventMask);
@@ -2613,17 +2623,17 @@ void FluxboxWindow::unmapNotifyEvent(XUnmapEvent *ue) {
2613 XEvent dummy; 2623 XEvent dummy;
2614 if (! XCheckTypedWindowEvent(display, client.window, ReparentNotify, 2624 if (! XCheckTypedWindowEvent(display, client.window, ReparentNotify,
2615 &dummy)) { 2625 &dummy)) {
2616#ifdef DEBUG 2626 #ifdef DEBUG
2617 fprintf(stderr, 2627 fprintf(stderr,
2618 I18n::instance()->getMessage( 2628 I18n::instance()->getMessage(
2619#ifdef NLS 2629 #ifdef NLS
2620 WindowSet, WindowUnmapNotifyReparent, 2630 WindowSet, WindowUnmapNotifyReparent,
2621#else // !NLS 2631 #else // !NLS
2622 0, 0, 2632 0, 0,
2623#endif // NLS 2633 #endif // NLS
2624 "FluxboxWindow::unmapNotifyEvent(): reparent 0x%lx to " 2634 "FluxboxWindow::unmapNotifyEvent(): reparent 0x%lx to "
2625 "root.\n"), client.window); 2635 "root.\n"), client.window);
2626#endif // DEBUG 2636 #endif // DEBUG
2627 restoreGravity(); 2637 restoreGravity();
2628 XReparentWindow(display, client.window, screen->getRootWindow(), 2638 XReparentWindow(display, client.window, screen->getRootWindow(),
2629 client.x, client.y); 2639 client.x, client.y);
@@ -2633,8 +2643,10 @@ void FluxboxWindow::unmapNotifyEvent(XUnmapEvent *ue) {
2633 2643
2634 fluxbox->ungrab(); 2644 fluxbox->ungrab();
2635 2645
2636 delete this; 2646 return true;
2637 } 2647 }
2648
2649 return false;
2638} 2650}
2639 2651
2640//----------- destroyNotifyEvent ------------- 2652//----------- destroyNotifyEvent -------------