fixed unmapNotifyEvent to return a value instead of suicide
This commit is contained in:
parent
59761a0f25
commit
5f39282ce6
1 changed files with 56 additions and 44 deletions
100
src/Window.cc
100
src/Window.cc
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: Window.cc,v 1.27 2002/02/16 02:14:54 pekdon Exp $
|
// $Id: Window.cc,v 1.28 2002/02/16 11:25:41 fluxgen Exp $
|
||||||
|
|
||||||
//use GNU extensions
|
//use GNU extensions
|
||||||
#ifndef _GNU_SOURCE
|
#ifndef _GNU_SOURCE
|
||||||
|
@ -172,7 +172,6 @@ tab(0)
|
||||||
if (!screen)
|
if (!screen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
image_ctrl = screen->getImageControl();
|
image_ctrl = screen->getImageControl();
|
||||||
|
|
||||||
client.x = wattrib.x;
|
client.x = wattrib.x;
|
||||||
|
@ -331,29 +330,7 @@ tab(0)
|
||||||
|
|
||||||
associateClientWindow();
|
associateClientWindow();
|
||||||
|
|
||||||
|
grabButtons();
|
||||||
XGrabButton(display, Button1, AnyModifier,
|
|
||||||
frame.plate, True, ButtonPressMask,
|
|
||||||
GrabModeSync, GrabModeSync, None, None);
|
|
||||||
XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask, frame.plate);
|
|
||||||
|
|
||||||
|
|
||||||
XGrabButton(display, Button1, Mod1Mask, frame.window, True,
|
|
||||||
ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
|
|
||||||
GrabModeAsync, None, fluxbox->getMoveCursor());
|
|
||||||
|
|
||||||
//----grab with "all" modifiers
|
|
||||||
grabButton(display, Button1, frame.window, fluxbox->getMoveCursor());
|
|
||||||
|
|
||||||
XGrabButton(display, Button2, Mod1Mask, frame.window, True,
|
|
||||||
ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None);
|
|
||||||
|
|
||||||
XGrabButton(display, Button3, Mod1Mask, frame.window, True,
|
|
||||||
ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
|
|
||||||
GrabModeAsync, None, fluxbox->getLowerRightAngleCursor());
|
|
||||||
|
|
||||||
//---grab with "all" modifiers
|
|
||||||
grabButton(display, Button3, frame.window, fluxbox->getLowerRightAngleCursor());
|
|
||||||
|
|
||||||
positionWindows();
|
positionWindows();
|
||||||
|
|
||||||
|
@ -406,8 +383,11 @@ tab(0)
|
||||||
|
|
||||||
|
|
||||||
FluxboxWindow::~FluxboxWindow(void) {
|
FluxboxWindow::~FluxboxWindow(void) {
|
||||||
|
if (screen==0) //the window wasn't created
|
||||||
|
return;
|
||||||
|
|
||||||
#ifdef GNOME
|
#ifdef GNOME
|
||||||
XDeleteProperty (display, client.window, screen->getBaseDisplay()->getGnomeWorkspaceAtom());
|
XDeleteProperty(display, client.window, screen->getBaseDisplay()->getGnomeWorkspaceAtom());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Fluxbox *fluxbox = Fluxbox::instance();
|
Fluxbox *fluxbox = Fluxbox::instance();
|
||||||
|
@ -850,6 +830,32 @@ void FluxboxWindow::decorateLabel(void) {
|
||||||
if (tmp) image_ctrl->removeImage(tmp);
|
if (tmp) image_ctrl->removeImage(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FluxboxWindow::grabButtons() {
|
||||||
|
Fluxbox *fluxbox = Fluxbox::instance();
|
||||||
|
|
||||||
|
XGrabButton(display, Button1, AnyModifier,
|
||||||
|
frame.plate, True, ButtonPressMask,
|
||||||
|
GrabModeSync, GrabModeSync, None, None);
|
||||||
|
XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask, frame.plate);
|
||||||
|
|
||||||
|
|
||||||
|
XGrabButton(display, Button1, Mod1Mask, frame.window, True,
|
||||||
|
ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
|
||||||
|
GrabModeAsync, None, fluxbox->getMoveCursor());
|
||||||
|
|
||||||
|
//----grab with "all" modifiers
|
||||||
|
grabButton(display, Button1, frame.window, fluxbox->getMoveCursor());
|
||||||
|
|
||||||
|
XGrabButton(display, Button2, Mod1Mask, frame.window, True,
|
||||||
|
ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None);
|
||||||
|
|
||||||
|
XGrabButton(display, Button3, Mod1Mask, frame.window, True,
|
||||||
|
ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
|
||||||
|
GrabModeAsync, None, fluxbox->getLowerRightAngleCursor());
|
||||||
|
|
||||||
|
//---grab with "all" modifiers
|
||||||
|
grabButton(display, Button3, frame.window, fluxbox->getLowerRightAngleCursor());
|
||||||
|
}
|
||||||
void FluxboxWindow::createButton(int type, ButtonEventProc pressed, ButtonEventProc released, ButtonDrawProc draw) {
|
void FluxboxWindow::createButton(int type, ButtonEventProc pressed, ButtonEventProc released, ButtonDrawProc draw) {
|
||||||
Button b;
|
Button b;
|
||||||
b.win = createChildWindow(frame.title);
|
b.win = createChildWindow(frame.title);
|
||||||
|
@ -883,13 +889,13 @@ long FluxboxWindow::getGnomeWindowState() {
|
||||||
if (isShaded())
|
if (isShaded())
|
||||||
state |= BaseDisplay::WIN_STATE_SHADED;
|
state |= BaseDisplay::WIN_STATE_SHADED;
|
||||||
/*TODO: states:
|
/*TODO: states:
|
||||||
WIN_STATE_MAXIMIZED_VERT = (1<<2), // window in maximized V state
|
WIN_STATE_MAXIMIZED_VERT // window in maximized V state
|
||||||
WIN_STATE_MAXIMIZED_HORIZ = (1<<3), // window in maximized H state
|
WIN_STATE_MAXIMIZED_HORIZ // window in maximized H state
|
||||||
WIN_STATE_HIDDEN = (1<<4), // not on taskbar but window visible
|
WIN_STATE_HIDDEN // not on taskbar but window visible
|
||||||
WIN_STATE_HID_WORKSPACE = (1<<6), // not on current desktop
|
WIN_STATE_HID_WORKSPACE // not on current desktop
|
||||||
WIN_STATE_HID_TRANSIENT = (1<<7), // owner of transient is hidden
|
WIN_STATE_HID_TRANSIENT // owner of transient is hidden
|
||||||
WIN_STATE_FIXED_POSITION = (1<<8), // window is fixed in position even
|
WIN_STATE_FIXED_POSITION // window is fixed in position even
|
||||||
WIN_STATE_ARRANGE_IGNORE = (1<<9) // ignore for auto arranging
|
WIN_STATE_ARRANGE_IGNORE // ignore for auto arranging
|
||||||
*/
|
*/
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -1417,7 +1423,7 @@ void FluxboxWindow::getWMNormalHints(void) {
|
||||||
client.max_aspect_y = sizehint.max_aspect.y;
|
client.max_aspect_y = sizehint.max_aspect.y;
|
||||||
} else
|
} else
|
||||||
client.min_aspect_x = client.min_aspect_y =
|
client.min_aspect_x = client.min_aspect_y =
|
||||||
client.max_aspect_x = client.max_aspect_y = 1;
|
client.max_aspect_x = client.max_aspect_y = 1;
|
||||||
|
|
||||||
if (sizehint.flags & PBaseSize) {
|
if (sizehint.flags & PBaseSize) {
|
||||||
client.base_width = sizehint.base_width;
|
client.base_width = sizehint.base_width;
|
||||||
|
@ -1753,7 +1759,6 @@ void FluxboxWindow::setTab(bool flag) {
|
||||||
//--------------------------------------
|
//--------------------------------------
|
||||||
void FluxboxWindow::iconify(void) {
|
void FluxboxWindow::iconify(void) {
|
||||||
|
|
||||||
|
|
||||||
if (iconic)
|
if (iconic)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -2580,8 +2585,13 @@ void FluxboxWindow::mapNotifyEvent(XMapEvent *ne) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------- unmapNotify ------------------
|
||||||
void FluxboxWindow::unmapNotifyEvent(XUnmapEvent *ue) {
|
// Unmaps frame window and client window if
|
||||||
|
// event.window == client.window
|
||||||
|
// Returns true if *this should die
|
||||||
|
// else false
|
||||||
|
//-------------------------------------------------
|
||||||
|
bool FluxboxWindow::unmapNotifyEvent(XUnmapEvent *ue) {
|
||||||
if (ue->window == client.window) {
|
if (ue->window == client.window) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
@ -2599,7 +2609,7 @@ void FluxboxWindow::unmapNotifyEvent(XUnmapEvent *ue) {
|
||||||
BaseDisplay::GrabGuard gg(*fluxbox);
|
BaseDisplay::GrabGuard gg(*fluxbox);
|
||||||
fluxbox->grab();
|
fluxbox->grab();
|
||||||
if (! validateClient())
|
if (! validateClient())
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
XChangeSaveSet(display, client.window, SetModeDelete);
|
XChangeSaveSet(display, client.window, SetModeDelete);
|
||||||
XSelectInput(display, client.window, NoEventMask);
|
XSelectInput(display, client.window, NoEventMask);
|
||||||
|
@ -2613,17 +2623,17 @@ void FluxboxWindow::unmapNotifyEvent(XUnmapEvent *ue) {
|
||||||
XEvent dummy;
|
XEvent dummy;
|
||||||
if (! XCheckTypedWindowEvent(display, client.window, ReparentNotify,
|
if (! XCheckTypedWindowEvent(display, client.window, ReparentNotify,
|
||||||
&dummy)) {
|
&dummy)) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
I18n::instance()->getMessage(
|
I18n::instance()->getMessage(
|
||||||
#ifdef NLS
|
#ifdef NLS
|
||||||
WindowSet, WindowUnmapNotifyReparent,
|
WindowSet, WindowUnmapNotifyReparent,
|
||||||
#else // !NLS
|
#else // !NLS
|
||||||
0, 0,
|
0, 0,
|
||||||
#endif // NLS
|
#endif // NLS
|
||||||
"FluxboxWindow::unmapNotifyEvent(): reparent 0x%lx to "
|
"FluxboxWindow::unmapNotifyEvent(): reparent 0x%lx to "
|
||||||
"root.\n"), client.window);
|
"root.\n"), client.window);
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
restoreGravity();
|
restoreGravity();
|
||||||
XReparentWindow(display, client.window, screen->getRootWindow(),
|
XReparentWindow(display, client.window, screen->getRootWindow(),
|
||||||
client.x, client.y);
|
client.x, client.y);
|
||||||
|
@ -2633,8 +2643,10 @@ void FluxboxWindow::unmapNotifyEvent(XUnmapEvent *ue) {
|
||||||
|
|
||||||
fluxbox->ungrab();
|
fluxbox->ungrab();
|
||||||
|
|
||||||
delete this;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------- destroyNotifyEvent -------------
|
//----------- destroyNotifyEvent -------------
|
||||||
|
|
Loading…
Reference in a new issue