summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2010-12-08 00:54:29 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2010-12-08 00:54:29 +0800
commitabb087437f97baa09046b4d081c10a71de5f97ad (patch)
treefac3e67b4076d9d867d4e9e7f68c1b3fcaa1f33d
parent9211a51cf0cc98ae6fef4a33a4cc13c3f0959ac0 (diff)
parent4666435ec53105675c67225e6d5fd18101627353 (diff)
downloadcompiz-with-glib-mainloop-abb087437f97baa09046b4d081c10a71de5f97ad.tar.gz
compiz-with-glib-mainloop-abb087437f97baa09046b4d081c10a71de5f97ad.tar.bz2
Merge git://git.compiz.org/compiz/core into glibmm-experimental
Conflicts: include/core/screen.h
-rw-r--r--gtk/gnome/50-compiz-desktop-key.xml.in12
-rw-r--r--gtk/gnome/50-compiz-key.xml.in34
-rw-r--r--include/core/screen.h6
-rw-r--r--plugins/compiztoolbox/src/compiztoolbox.cpp4
-rw-r--r--plugins/decor/src/decor.cpp16
-rw-r--r--plugins/gnomecompat/gnomecompat.xml.in2
-rw-r--r--plugins/obs/obs.xml.in24
-rw-r--r--plugins/place/src/place.cpp11
-rw-r--r--plugins/resize/src/resize.cpp49
-rw-r--r--plugins/resize/src/resize.h3
-rw-r--r--plugins/scale/src/privates.h2
-rw-r--r--plugins/scale/src/scale.cpp31
-rw-r--r--plugins/screenshot/src/screenshot.cpp3
-rw-r--r--plugins/switcher/src/switcher.cpp23
-rw-r--r--plugins/switcher/src/switcher.h5
-rw-r--r--src/event.cpp1
-rw-r--r--src/main.cpp101
-rw-r--r--src/plugin.cpp22
-rw-r--r--src/privatescreen.h29
-rw-r--r--src/privatewindow.h3
-rw-r--r--src/screen.cpp239
-rw-r--r--src/window.cpp207
22 files changed, 566 insertions, 261 deletions
diff --git a/gtk/gnome/50-compiz-desktop-key.xml.in b/gtk/gnome/50-compiz-desktop-key.xml.in
index b8f9db7..c57e56c 100644
--- a/gtk/gnome/50-compiz-desktop-key.xml.in
+++ b/gtk/gnome/50-compiz-desktop-key.xml.in
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<KeyListEntries _name="Desktop" wm_name="Compiz" package="compiz">
- <KeyListEntry name="/apps/compiz/plugins/gnomecompat/options/run_key"/>
+ <KeyListEntry name="/apps/compiz-1/plugins/gnomecompat/screen0/options/run_key"/>
- <KeyListEntry name="/apps/compiz/plugins/gnomecompat/options/main_menu_key"/>
+ <KeyListEntry name="/apps/compiz-1/plugins/gnomecompat/screen0/options/main_menu_key"/>
- <KeyListEntry name="/apps/compiz/plugins/gnomecompat/allscreens/options/run_command_screenshot_key"/>
+ <KeyListEntry name="/apps/compiz-1/plugins/gnomecompat/screen0/options/run_command_screenshot_key"/>
- <KeyListEntry name="/apps/compiz/plugins/gnomecompat/allscreens/options/run_command_window_screenshot_key"/>
+ <KeyListEntry name="/apps/compiz-1/plugins/gnomecompat/screen0/options/run_command_window_screenshot_key"/>
- <KeyListEntry name="/apps/compiz/general/allscreens/options/show_desktop_key"/>
+ <KeyListEntry name="/apps/compiz-1/general/screen0/options/show_desktop_key"/>
- <KeyListEntry name="/apps/compiz/plugins/gnomecompat/allscreens/options/run_command_terminal_key"/>
+ <KeyListEntry name="/apps/compiz-1/plugins/gnomecompat/screen0/options/run_command_terminal_key"/>
</KeyListEntries>
diff --git a/gtk/gnome/50-compiz-key.xml.in b/gtk/gnome/50-compiz-key.xml.in
index ad73a40..abfa799 100644
--- a/gtk/gnome/50-compiz-key.xml.in
+++ b/gtk/gnome/50-compiz-key.xml.in
@@ -1,36 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
-<KeyListEntries _name="Window Management" wm_name="Compiz" package="compiz">
+<KeyListEntries _name="Window Management" wm_name="compiz-1" package="compiz-1">
- <KeyListEntry name="/apps/compiz/general/allscreens/options/close_window_key"/>
+ <KeyListEntry name="/apps/compiz-1/general/screen0/options/close_window_key"/>
- <KeyListEntry name="/apps/compiz/general/allscreens/options/raise_window_key"/>
+ <KeyListEntry name="/apps/compiz-1/general/screen0/options/raise_window_key"/>
- <KeyListEntry name="/apps/compiz/general/allscreens/options/lower_window_key"/>
+ <KeyListEntry name="/apps/compiz-1/general/screen0/options/lower_window_key"/>
- <KeyListEntry name="/apps/compiz/general/allscreens/options/maximize_window_key"/>
+ <KeyListEntry name="/apps/compiz-1/general/screen0/options/maximize_window_key"/>
- <KeyListEntry name="/apps/compiz/general/allscreens/options/maximize_window_horizontally_key"/>
+ <KeyListEntry name="/apps/compiz-1/general/screen0/options/unmaximize_window_key"/>
- <KeyListEntry name="/apps/compiz/general/allscreens/options/maximize_window_vertically_key"/>
+ <KeyListEntry name="/apps/compiz-1/general/screen0/options/minimize_window_key"/>
- <KeyListEntry name="/apps/compiz/general/allscreens/options/minimize_window_key"/>
+ <KeyListEntry name="/apps/compiz-1/general/screen0/options/toggle_window_maximized_horizontally_key"/>
- <KeyListEntry name="/apps/compiz/plugins/obs/allscreens/options/opacity_decrease_key"/>
+ <KeyListEntry name="/apps/compiz-1/general/screen0/options/toggle_window_maximized_vertically_key"/>
- <KeyListEntry name="/apps/compiz/plugins/obs/allscreens/options/opacity_increase_key"/>
+ <KeyListEntry name="/apps/compiz-1/general/screen0/options/toggle_window_shaded_key"/>
- <KeyListEntry name="/apps/compiz/general/allscreens/options/show_desktop_key"/>
+ <KeyListEntry name="/apps/compiz-1/general/screen0/options/unmaximize_window_key"/>
- <KeyListEntry name="/apps/compiz/general/allscreens/options/toggle_window_maximized_key"/>
+ <KeyListEntry name="/apps/compiz-1/general/screen0/options/window_menu_key"/>
- <KeyListEntry name="/apps/compiz/general/allscreens/options/toggle_window_maximized_horizontally_key"/>
-
- <KeyListEntry name="/apps/compiz/general/allscreens/options/toggle_window_maximized_vertically_key"/>
-
- <KeyListEntry name="/apps/compiz/general/allscreens/options/toggle_window_shaded_key"/>
-
- <KeyListEntry name="/apps/compiz/general/allscreens/options/unmaximize_window_key"/>
-
- <KeyListEntry name="/apps/compiz/general/allscreens/options/window_menu_key"/>
+ <KeyListEntry name="/apps/compiz-1/general/screen0/options/initiate_key"/>
</KeyListEntries>
diff --git a/include/core/screen.h b/include/core/screen.h
index 9b6509d..aa6ab5a 100644
--- a/include/core/screen.h
+++ b/include/core/screen.h
@@ -39,6 +39,8 @@
class CompScreen;
class PrivateScreen;
+class CompManager;
+
typedef std::list<CompWindow *> CompWindowList;
typedef std::vector<CompWindow *> CompWindowVector;
@@ -400,6 +402,8 @@ class CompScreen :
friend class PrivateWindow;
friend class ModifierHandler;
friend class CompEventSource;
+ friend class CompManager;
+ friend class CompWatchFd;
private:
PrivateScreen *priv;
@@ -467,8 +471,6 @@ class CompScreen :
void *userData);
static int checkForError (Display *dpy);
-
- friend class CompWatchFd;
};
#endif
diff --git a/plugins/compiztoolbox/src/compiztoolbox.cpp b/plugins/compiztoolbox/src/compiztoolbox.cpp
index 1ec4402..47f0288 100644
--- a/plugins/compiztoolbox/src/compiztoolbox.cpp
+++ b/plugins/compiztoolbox/src/compiztoolbox.cpp
@@ -397,7 +397,7 @@ BaseSwitchWindow::paintThumb (const GLWindowPaintAttrib &attrib,
int height2)
{
if (!openGLAvailable)
- return;
+ return;
GLWindowPaintAttrib sAttrib (attrib);
IconMode iconMode;
@@ -687,7 +687,7 @@ BaseSwitchScreen::BaseSwitchScreen (CompScreen *screen) :
selectWinAtom = PropertyWriter (CompString (DECOR_SWITCH_WINDOW_ATOM_NAME),
atomTemplate);
- selectFgColorAtom =
+ selectFgColorAtom =
XInternAtom (::screen->dpy (),
DECOR_SWITCH_FOREGROUND_COLOR_ATOM_NAME, 0);
diff --git a/plugins/decor/src/decor.cpp b/plugins/decor/src/decor.cpp
index 60a8810..511d99b 100644
--- a/plugins/decor/src/decor.cpp
+++ b/plugins/decor/src/decor.cpp
@@ -805,7 +805,21 @@ DecorWindow::update (bool allowDecoration)
window->saveWc ().y += moveDy;
if (mask)
- moveUpdate.start (boost::bind (decorOffsetMove, window, xwc, mask), 0);
+ {
+ /* allowDecoration is only false in the case of
+ * the destructor calling the update function so since it
+ * is not safe to put the function in a timer (since
+ * it will get unref'd on the vtable destruction) we
+ * need to do it immediately
+ *
+ * FIXME: CompTimer should really be PIMPL and allow
+ * refcounting in case we need to keep it alive
+ */
+ if (!allowDecoration)
+ decorOffsetMove (window, xwc, mask);
+ else
+ moveUpdate.start (boost::bind (decorOffsetMove, window, xwc, mask), 0);
+ }
}
return true;
diff --git a/plugins/gnomecompat/gnomecompat.xml.in b/plugins/gnomecompat/gnomecompat.xml.in
index 29f26d7..6015670 100644
--- a/plugins/gnomecompat/gnomecompat.xml.in
+++ b/plugins/gnomecompat/gnomecompat.xml.in
@@ -47,7 +47,7 @@
<option name="command_terminal" type="string">
<_short>Terminal command line</_short>
<_long>Terminal command line</_long>
- <default></default>
+ <default>gnome-terminal</default>
</option>
<option name="run_command_terminal_key" type="key">
<_short>Open a terminal</_short>
diff --git a/plugins/obs/obs.xml.in b/plugins/obs/obs.xml.in
index c2a48d9..e78cd64 100644
--- a/plugins/obs/obs.xml.in
+++ b/plugins/obs/obs.xml.in
@@ -17,22 +17,22 @@
<group>
<_short>Opacity</_short>
<option name="opacity_increase_key" type="key">
- <_short>Increase</_short>
+ <_short>Increase Opacity</_short>
<_long>Opacity Increase</_long>
<default/>
</option>
<option name="opacity_increase_button" type="button">
- <_short>Increase</_short>
+ <_short>Increase Opacity</_short>
<_long>Opacity Increase</_long>
<default>&lt;Alt&gt;Button4</default>
</option>
<option name="opacity_decrease_key" type="key">
- <_short>Decrease</_short>
+ <_short>Decrease Opacity</_short>
<_long>Opacity Decrease</_long>
<default/>
</option>
<option name="opacity_decrease_button" type="button">
- <_short>Decrease</_short>
+ <_short>Decrease Opacity</_short>
<_long>Opacity Decrease</_long>
<default>&lt;Alt&gt;Button5</default>
</option>
@@ -64,22 +64,22 @@
<group>
<_short>Brightness</_short>
<option name="brightness_increase_key" type="key">
- <_short>Increase</_short>
+ <_short>Increase Brightness</_short>
<_long>Brightness Increase</_long>
<default/>
</option>
<option name="brightness_increase_button" type="button">
- <_short>Increase</_short>
+ <_short>Increase Brightness</_short>
<_long>Brightness Increase</_long>
<default/>
</option>
<option name="brightness_decrease_key" type="key">
- <_short>Decrease</_short>
+ <_short>Decrease Brightness</_short>
<_long>Brightness Decrease</_long>
<default/>
</option>
<option name="brightness_decrease_button" type="button">
- <_short>Decrease</_short>
+ <_short>Decrease Brightness</_short>
<_long>Brightness Decrease</_long>
<default/>
</option>
@@ -111,22 +111,22 @@
<group>
<_short>Saturation</_short>
<option name="saturation_increase_key" type="key">
- <_short>Increase</_short>
+ <_short>Increase Saturation</_short>
<_long>Saturation Increase</_long>
<default/>
</option>
<option name="saturation_increase_button" type="button">
- <_short>Increase</_short>
+ <_short>Increase Saturation</_short>
<_long>Saturation Increase</_long>
<default/>
</option>
<option name="saturation_decrease_key" type="key">
- <_short>Decrease</_short>
+ <_short>Decrease Saturation</_short>
<_long>Saturation Decrease</_long>
<default/>
</option>
<option name="saturation_decrease_button" type="button">
- <_short>Decrease</_short>
+ <_short>Decrease Saturation</_short>
<_long>Saturation Decrease</_long>
<default/>
</option>
diff --git a/plugins/place/src/place.cpp b/plugins/place/src/place.cpp
index c2917b9..9f1b2c6 100644
--- a/plugins/place/src/place.cpp
+++ b/plugins/place/src/place.cpp
@@ -467,9 +467,9 @@ PlaceWindow::place (CompPoint &pos)
int x, y;
viewport.setX (MAX (MIN (viewport.x (),
- screen->vpSize ().width ()), 0));
+ screen->vpSize ().width () - 1), 0));
viewport.setY (MAX (MIN (viewport.y (),
- screen->vpSize ().height ()), 0));
+ screen->vpSize ().height () - 1), 0));
x = pos.x () % screen->width ();
if (x < 0)
@@ -889,8 +889,11 @@ PlaceWindow::placePointer (const CompRect &workArea,
{
if (PlaceScreen::get (screen)->getPointerPosition (pos))
{
- pos -= CompPoint (window->serverGeometry ().height () / 2,
- window->serverGeometry ().width () / 2);
+ unsigned int dx = (window->serverGeometry ().width () / 2) -
+ window->serverGeometry ().border ();
+ unsigned int dy = (window->serverGeometry ().height () / 2) -
+ window->serverGeometry ().border ();
+ pos -= CompPoint (dx, dy);
}
else
placeCentered (workArea, pos);
diff --git a/plugins/resize/src/resize.cpp b/plugins/resize/src/resize.cpp
index 386b2af..a8d3c4f 100644
--- a/plugins/resize/src/resize.cpp
+++ b/plugins/resize/src/resize.cpp
@@ -351,12 +351,17 @@ resizeInitiate (CompAction *action,
rs->isConstrained = sourceExternalApp;
+ /* Update offWorkAreaConstrained and workArea at grab time */
+ rs->offWorkAreaConstrained = false;
if (sourceExternalApp)
{
+ int output = w->outputDevice ();
/* Prevent resizing beyond work area edges when resize is
initiated externally (e.g. with window frame or menu)
and not with a key (e.g. alt+button) */
-
+ rs->offWorkAreaConstrained = true;
+ rs->grabWindowWorkArea =
+ &screen->outputDevs ().at (output).workArea ();
rs->inRegionStatus = false;
rs->lastGoodHotSpotY = -1;
rs->lastGoodSize = w->serverSize ();
@@ -711,6 +716,45 @@ ResizeScreen::handleMotionEvent (int xRoot, int yRoot)
damageRectangle (&box);
}
+ /* constrain to work area */
+ if (offWorkAreaConstrained)
+ {
+ if (mask & ResizeUpMask)
+ {
+ int decorTop = savedGeometry.y + savedGeometry.height -
+ (che + w->input ().top);
+
+ if (grabWindowWorkArea->y () > decorTop)
+ che -= grabWindowWorkArea->y () - decorTop;
+ }
+ if (mask & ResizeDownMask)
+ {
+ int decorBottom = savedGeometry.y + che + w->input ().bottom;
+
+ if (decorBottom >
+ grabWindowWorkArea->y () + grabWindowWorkArea->height ())
+ che -= decorBottom - (grabWindowWorkArea->y () +
+ grabWindowWorkArea->height ());
+ }
+ if (mask & ResizeLeftMask)
+ {
+ int decorLeft = savedGeometry.x + savedGeometry.width -
+ (cwi + w->input ().left);
+
+ if (grabWindowWorkArea->x () > decorLeft)
+ cwi -= grabWindowWorkArea->x () - decorLeft;
+ }
+ if (mask & ResizeRightMask)
+ {
+ int decorRight = savedGeometry.x + cwi + w->input ().right;
+
+ if (decorRight >
+ grabWindowWorkArea->x () + grabWindowWorkArea->width ())
+ cwi -= decorRight - (grabWindowWorkArea->x () +
+ grabWindowWorkArea->width ());
+ }
+ }
+
wi = cwi;
he = che;
@@ -1478,7 +1522,8 @@ ResizeScreen::ResizeScreen (CompScreen *s) :
stretchMask (0),
centeredMask (0),
releaseButton (0),
- isConstrained (false)
+ isConstrained (false),
+ offWorkAreaConstrained (true)
{
CompOption::Vector atomTemplate;
Display *dpy = s->dpy ();
diff --git a/plugins/resize/src/resize.h b/plugins/resize/src/resize.h
index 73c1c61..afab4d8 100644
--- a/plugins/resize/src/resize.h
+++ b/plugins/resize/src/resize.h
@@ -146,6 +146,9 @@ class ResizeScreen :
bool inRegionStatus;
int lastGoodHotSpotY;
CompSize lastGoodSize;
+
+ bool offWorkAreaConstrained;
+ const CompRect *grabWindowWorkArea;
};
class ResizeWindow :
diff --git a/plugins/scale/src/privates.h b/plugins/scale/src/privates.h
index 8b04c71..a58572a 100644
--- a/plugins/scale/src/privates.h
+++ b/plugins/scale/src/privates.h
@@ -92,7 +92,7 @@ class PrivateScaleScreen :
void moveFocusWindow (int dx, int dy);
- void windowRemove (Window id);
+ void windowRemove (CompWindow *);
bool hoverTimeout ();
diff --git a/plugins/scale/src/scale.cpp b/plugins/scale/src/scale.cpp
index 129a3d9..44adaf7 100644
--- a/plugins/scale/src/scale.cpp
+++ b/plugins/scale/src/scale.cpp
@@ -1348,9 +1348,8 @@ ScaleScreen::relayoutSlots (const CompMatch& match)
}
void
-PrivateScaleScreen::windowRemove (Window id)
+PrivateScaleScreen::windowRemove (CompWindow *w)
{
- CompWindow *w = screen->findWindow (id);
if (!w)
return;
@@ -1419,6 +1418,8 @@ PrivateScaleScreen::hoverTimeout ()
void
PrivateScaleScreen::handleEvent (XEvent *event)
{
+ CompWindow *w;
+
switch (event->type) {
case KeyPress:
if (screen->root () == event->xkey.root)
@@ -1483,11 +1484,23 @@ PrivateScaleScreen::handleEvent (XEvent *event)
focus);
}
break;
+ case DestroyNotify:
+
+ /* We need to get the CompWindow * for event->xdestroywindow.window
+ * here because in the ::handleEvent call below that CompWindow's
+ * id will become "1" so CompScreen::findWindow won't
+ * be able to find teh window after that
+ */
+
+ w = screen->findWindow (event->xdestroywindow.window);
+ break;
+ case UnmapNotify:
+
+ w = screen->findWindow (event->xunmap.window);
+ break;
case ClientMessage:
if (event->xclient.message_type == Atoms::xdndPosition)
{
- CompWindow *w;
-
w = screen->findWindow (event->xclient.window);
if (w)
{
@@ -1536,7 +1549,7 @@ PrivateScaleScreen::handleEvent (XEvent *event)
else if (event->xclient.message_type == Atoms::xdndDrop ||
event->xclient.message_type == Atoms::xdndLeave)
{
- CompWindow *w = screen->findWindow (event->xclient.window);
+ w = screen->findWindow (event->xclient.window);
if (w)
{
if (grab &&
@@ -1558,12 +1571,16 @@ PrivateScaleScreen::handleEvent (XEvent *event)
screen->handleEvent (event);
+ /* Only safe to remove the window after all events have been
+ * handled, so that we don't get race conditions on calls
+ * to scale functions */
+
switch (event->type) {
case UnmapNotify:
- windowRemove (event->xunmap.window);
+ windowRemove (w);
break;
case DestroyNotify:
- windowRemove (event->xdestroywindow.window);
+ windowRemove (w);
break;
}
}
diff --git a/plugins/screenshot/src/screenshot.cpp b/plugins/screenshot/src/screenshot.cpp
index b2f2dfb..2ba0a01 100644
--- a/plugins/screenshot/src/screenshot.cpp
+++ b/plugins/screenshot/src/screenshot.cpp
@@ -84,6 +84,9 @@ ShotScreen::terminate (CompAction *action,
::screen->handleEventSetEnabled (this, false);
+ if (state & CompAction::StateCancel)
+ mGrab = false;
+
if (mX1 != mX2 && mY1 != mY2)
{
int x1 = MIN (mX1, mX2) - 1;
diff --git a/plugins/switcher/src/switcher.cpp b/plugins/switcher/src/switcher.cpp
index 58fe35b..7a25b9a 100644
--- a/plugins/switcher/src/switcher.cpp
+++ b/plugins/switcher/src/switcher.cpp
@@ -79,9 +79,9 @@ SwitchScreen::updateWindowList (int count)
XWindowChanges xwc;
unsigned int valueMask = 0;
-
+
valueMask |= (CWX | CWY | CWWidth | CWHeight);
-
+
xwc.x = x - WINDOW_WIDTH (count) / 2;
xwc.y = y - WINDOW_HEIGHT / 2;
xwc.width = WINDOW_WIDTH (count);
@@ -207,7 +207,7 @@ SwitchScreen::initiate (SwitchWindowSelection selection,
{
int count;
- if (screen->otherGrabExist ("switcher", "scale", "cube", NULL))
+ if (screen->otherGrabExist ("switcher", NULL))
return;
this->selection = selection;
@@ -380,11 +380,11 @@ switchTerminate (CompAction *action,
{
ss->selectedWindow = NULL;
ss->zoomedWindow = NULL;
-
+
if (screen->activeWindow () != ss->lastActiveWindow)
{
CompWindow *w = screen->findWindow (ss->lastActiveWindow);
-
+
if (w)
w->moveInputFocusTo ();
}
@@ -950,6 +950,14 @@ SwitchWindow::updateIconPos (int &wx,
wy = y + SPACE + ((HEIGHT - (SPACE << 1)) - height) / 2;
}
+
+/* Only for the popup window */
+bool
+SwitchWindow::managed ()
+{
+ return true;
+}
+
bool
SwitchWindow::glPaint (const GLWindowPaintAttrib &attrib,
const GLMatrix &transform,
@@ -1178,6 +1186,11 @@ SwitchWindow::SwitchWindow (CompWindow *window) :
GLWindowInterface::setHandler (gWindow, false);
CompositeWindowInterface::setHandler (cWindow, false);
+ if (window->id () == sScreen->popupWindow)
+ WindowInterface::setHandler (window, true);
+ else
+ WindowInterface::setHandler (window, false);
+
if (sScreen->popupWindow && sScreen->popupWindow == window->id ())
gWindow->glPaintSetEnabled (this, true);
}
diff --git a/plugins/switcher/src/switcher.h b/plugins/switcher/src/switcher.h
index dee22d2..68d3f2a 100644
--- a/plugins/switcher/src/switcher.h
+++ b/plugins/switcher/src/switcher.h
@@ -76,7 +76,7 @@ class SwitchScreen :
void windowRemove (CompWindow *w);
bool adjustVelocity ();
-
+
Window lastActiveWindow;
CompWindow *zoomedWindow;
@@ -100,6 +100,7 @@ class SwitchScreen :
class SwitchWindow :
public BaseSwitchWindow,
+ public WindowInterface,
public CompositeWindowInterface,
public GLWindowInterface,
public PluginClassHandler<SwitchWindow,CompWindow>
@@ -107,6 +108,8 @@ class SwitchWindow :
public:
SwitchWindow (CompWindow *window);
+ bool managed ();
+
bool damageRect (bool initial, const CompRect &rect);
bool glPaint (const GLWindowPaintAttrib &, const GLMatrix &,
diff --git a/src/event.cpp b/src/event.cpp
index 4d7a2c6..ee4ddfd 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -1085,7 +1085,6 @@ CompScreen::handleEvent (XEvent *event)
priv->setWmState (WithdrawnState, w->id ());
w->priv->placed = false;
- w->priv->managed = false;
w->priv->unmanaging = true;
if (w->priv->frame)
{
diff --git a/src/main.cpp b/src/main.cpp
index ea8b509..a8e4445 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -57,10 +57,12 @@ bool useDesktopHints = false;
bool debugOutput = false;
bool useCow = true;
+std::list <CompString> initialPlugins;
+
unsigned int pluginClassHandlerIndex = 0;
-static void
-usage (void)
+void
+CompManager::usage ()
{
printf ("Usage: %s "
"[--replace] "
@@ -99,35 +101,20 @@ signalHandler (int sig)
}
}
-int
-main (int argc, char **argv)
+bool
+CompManager::parseArguments (int argc, char **argv)
{
- char *displayName = 0;
- std::vector<CompString> plugins;
- int i;
- bool disableSm = false;
- char *clientId = NULL;
-
- programName = argv[0];
- programArgc = argc;
- programArgv = argv;
-
- signal (SIGHUP, signalHandler);
- signal (SIGCHLD, signalHandler);
- signal (SIGINT, signalHandler);
- signal (SIGTERM, signalHandler);
-
- for (i = 1; i < argc; i++)
+ for (int i = 1; i < argc; i++)
{
if (!strcmp (argv[i], "--help"))
{
usage ();
- return 0;
+ return false;
}
else if (!strcmp (argv[i], "--version"))
{
printf (PACKAGE_STRING "\n");
- return 0;
+ return false;
}
else if (!strcmp (argv[i], "--debug"))
{
@@ -183,14 +170,34 @@ main (int argc, char **argv)
}
}
+ initialPlugins = plugins;
+
+ return true;
+}
+
+CompManager::CompManager () :
+ disableSm (false)
+{
+}
+
+bool
+CompManager::init ()
+{
screen = new CompScreen ();
- if (!screen)
- return 1;
+
+ if (!screen || !screen->priv)
+ return false;
+
+ if (screen->priv->createFailed ())
+ {
+ delete screen;
+ return false;
+ }
modHandler = new ModifierHandler ();
if (!modHandler)
- return 1;
+ return false;
if (!plugins.empty ())
{
@@ -210,21 +217,59 @@ main (int argc, char **argv)
o->set (value);
}
- if (!screen->init (displayName))
- return 1;
+ screen->priv->dirtyPluginList = true;
+ screen->priv->updatePlugins ();
- modHandler->updateModifierMappings ();
+ if (!screen->init (displayName))
+ return false;
if (!disableSm)
CompSession::init (clientId);
+ return true;
+}
+
+void
+CompManager::run ()
+{
screen->eventLoop ();
+}
+void
+CompManager::fini ()
+{
if (!disableSm)
CompSession::close ();
delete screen;
delete modHandler;
+}
+
+
+
+int
+main (int argc, char **argv)
+{
+ CompManager manager;
+
+ programName = argv[0];
+ programArgc = argc;
+ programArgv = argv;
+
+ signal (SIGHUP, signalHandler);
+ signal (SIGCHLD, signalHandler);
+ signal (SIGINT, signalHandler);
+ signal (SIGTERM, signalHandler);
+
+ if (!manager.parseArguments (argc, argv))
+ return 0;
+
+ if (!manager.init ())
+ return 1;
+
+ manager.run ();
+
+ manager.fini ();
if (restartSignal)
{
diff --git a/src/plugin.cpp b/src/plugin.cpp
index f9d8954..dd5bc7e8 100644
--- a/src/plugin.cpp
+++ b/src/plugin.cpp
@@ -264,8 +264,8 @@ UnloadPluginProc loaderUnloadPlugin = dlloaderUnloadPlugin;
ListPluginsProc loaderListPlugins = dlloaderListPlugins;
-static bool
-initPlugin (CompPlugin *p)
+bool
+CompManager::initPlugin (CompPlugin *p)
{
if (!p->vTable->init ())
@@ -275,7 +275,7 @@ initPlugin (CompPlugin *p)
return false;
}
- if (screen)
+ if (screen && screen->priv->initialized)
{
if (!p->vTable->initScreen (screen))
{
@@ -294,8 +294,8 @@ initPlugin (CompPlugin *p)
return true;
}
-static void
-finiPlugin (CompPlugin *p)
+void
+CompManager::finiPlugin (CompPlugin *p)
{
if (screen)
@@ -351,18 +351,18 @@ CompScreen::finiPluginForScreen (CompPlugin *p)
bool
CompPlugin::screenInitPlugins (CompScreen *s)
{
- CompPlugin::List::reverse_iterator rit = plugins.rbegin ();
+ CompPlugin::List::iterator it = plugins.begin ();
CompPlugin *p = NULL;
- while (rit != plugins.rend ())
+ while (it != plugins.end ())
{
- p = (*rit);
+ p = (*it);
if (p->vTable->initScreen (s))
s->initPluginForScreen (p);
- rit++;
+ it++;
}
return true;
@@ -491,7 +491,7 @@ CompPlugin::push (CompPlugin *p)
plugins.push_front (p);
- if (!initPlugin (p))
+ if (!CompManager::initPlugin (p))
{
compLogMessage ("core", CompLogLevelError,
"Couldn't activate plugin '%s'", name);
@@ -518,7 +518,7 @@ CompPlugin::pop (void)
pluginsMap.erase (p->vTable->name ().c_str ());
- finiPlugin (p);
+ CompManager::finiPlugin (p);
plugins.pop_front ();
diff --git a/src/privatescreen.h b/src/privatescreen.h
index 0f03d83..f6b9bb9 100644
--- a/src/privatescreen.h
+++ b/src/privatescreen.h
@@ -78,6 +78,8 @@ extern bool inHandleEvent;
extern CompScreen *targetScreen;
extern CompOutput *targetOutput;
+extern std::list <CompString> initialPlugins;
+
typedef struct _CompDelayedEdgeSettings
{
@@ -345,6 +347,9 @@ class PrivateScreen : public CoreOptions {
CompWindow *
focusTopMostWindow ();
+ bool
+ createFailed ();
+
public:
PrivateScreen *priv;
@@ -485,4 +490,28 @@ class PrivateScreen : public CoreOptions {
bool initialized;
};
+class CompManager
+{
+ public:
+
+ CompManager ();
+
+ bool init ();
+ void run ();
+ void fini ();
+
+ bool parseArguments (int, char **);
+ void usage ();
+
+ static bool initPlugin (CompPlugin *p);
+ static void finiPlugin (CompPlugin *p);
+
+ private:
+
+ std::list <CompString> plugins;
+ bool disableSm;
+ char *clientId;
+ char *displayName;
+};
+
#endif
diff --git a/src/privatewindow.h b/src/privatewindow.h
index 59521be..f750674 100644
--- a/src/privatewindow.h
+++ b/src/privatewindow.h
@@ -172,7 +172,8 @@ class PrivateWindow {
unsigned int adjustConfigureRequestForGravity (XWindowChanges *xwc,
unsigned int xwcm,
- int gravity);
+ int gravity,
+ int direction);
void updateSize ();
diff --git a/src/screen.cpp b/src/screen.cpp
index 4b7d95a..e296b03 100644
--- a/src/screen.cpp
+++ b/src/screen.cpp
@@ -868,48 +868,117 @@ PrivateScreen::processEvents ()
void
PrivateScreen::updatePlugins ()
{
- CompPlugin *p;
- unsigned int nPop, i, j;
- CompPlugin::List pop;
- bool failedPush;
+ CompPlugin *p;
+ unsigned int nPop, i, j, pListCount = 1;
+ CompOption::Value::Vector pList;
+ CompPlugin::List pop;
+ bool failedPush;
dirtyPluginList = false;
CompOption::Value::Vector &list = optionGetActivePlugins ();
- /* The old plugin list always begins with the core plugin. To make sure
- we don't unnecessarily unload plugins if the new plugin list does not
- contain the core plugin, we have to use an offset */
+ /* Determine the number of plugins, which is core +
+ * initial plugins + plugins in option list in addition
+ * to initial plugins */
+ foreach (CompString &pn, initialPlugins)
+ {
+ if (pn != "core")
+ pListCount++;
+ }
- if (list.size () > 0 && list[0].s () != "core")
- i = 0;
- else
- i = 1;
+ foreach (CompOption::Value &lp, list)
+ {
+ bool skip = false;
+ if (lp.s () == "core")
+ continue;
+
+ foreach (CompString &p, initialPlugins)
+ {
+ if (p == lp.s ())
+ {
+ skip = true;
+ break;
+ }
+ }
+
+ /* plugin not in initial list */
+ if (!skip)
+ pListCount++;
+ }
+
+ /* dupPluginCount is now the number of plugisn contained in both the
+ * initial and new plugins list */
+ pList.resize (pListCount);
+
+ if (pList.empty ())
+ {
+ screen->setOptionForPlugin ("core", "active_plugins", plugin);
+ return;
+ }
+
+ /* Must have core as first plugin */
+ pList.at (0) = "core";
+ j = 1;
+
+ /* Add initial plugins */
+ foreach (CompString &p, initialPlugins)
+ {
+ if (p == "core")
+ continue;
+ pList.at (j).set (p);
+ j++;
+ }
+
+ /* Add plugins not in the initial list */
+ foreach (CompOption::Value &opt, list)
+ {
+ std::list <CompString>::iterator it = initialPlugins.begin ();
+ bool skip = false;
+ if (opt.s () == "core")
+ continue;
+
+ for (; it != initialPlugins.end (); it++)
+ {
+ if ((*it) == opt.s ())
+ {
+ skip = true;
+ break;
+ }
+ }
+
+ if (!skip)
+ pList.at (j++).set (opt.s ());
+ }
+
+ assert (j == pList.size ());
/* j is initialized to 1 to make sure we never pop the core plugin */
- for (j = 1; j < plugin.list ().size () &&
- i < list.size (); i++, j++)
+ for (i = j = 1; j < plugin.list ().size () && i < pList.size (); i++, j++)
{
- if (plugin.list ()[j].s () != list[i].s ())
+ if (plugin.list ().at (j).s () != pList.at (i).s ())
break;
}
nPop = plugin.list ().size () - j;
- for (j = 0; j < nPop; j++)
+ if (nPop)
{
- pop.push_back (CompPlugin::pop ());
- plugin.list ().pop_back ();
+ for (j = 0; j < nPop; j++)
+ {
+ pop.push_back (CompPlugin::pop ());
+ plugin.list ().pop_back ();
+ }
}
- for (; i < list.size (); i++)
+ for (; i < pList.size (); i++)
{
p = NULL;
failedPush = false;
foreach (CompPlugin *pp, pop)
{
- if (list[i]. s () == pp->vTable->name ())
+ if (pList[i]. s () == pp->vTable->name ())
{
if (CompPlugin::push (pp))
{
@@ -930,7 +999,7 @@ PrivateScreen::updatePlugins ()
if (p == 0 && !failedPush)
{
- p = CompPlugin::load (list[i].s ().c_str ());
+ p = CompPlugin::load (pList[i].s ().c_str ());
if (p)
{
if (!CompPlugin::push (p))
@@ -4160,13 +4229,46 @@ CompScreen::screenInfo ()
return priv->screenInfo;
}
+bool
+PrivateScreen::createFailed ()
+{
+ return !screenInitalized;
+}
+
CompScreen::CompScreen ():
PluginClassStorage (screenPluginClassIndices),
priv (NULL)
{
+ CompPrivate p;
+ CompOption::Value::Vector vList;
+ CompPlugin *corePlugin;
+
priv = new PrivateScreen (this);
assert (priv);
+
screenInitalized = true;
+
+ corePlugin = CompPlugin::load ("core");
+ if (!corePlugin)
+ {
+ compLogMessage ("core", CompLogLevelFatal,
+ "Couldn't load core plugin");
+ screenInitalized = false;
+ }
+
+ if (!CompPlugin::push (corePlugin))
+ {
+ compLogMessage ("core", CompLogLevelFatal,
+ "Couldn't activate core plugin");
+ screenInitalized = false;
+ }
+
+ p.uval = CORE_ABIVERSION;
+ storeValue ("core_ABI", p);
+
+ vList.push_back ("core");
+
+ priv->plugin.set (CompOption::TypeString, vList);
}
bool
@@ -4195,31 +4297,6 @@ CompScreen::init (const char *name)
int nvisinfo;
XSetWindowAttributes attrib;
- CompOption::Value::Vector vList;
-
- CompPlugin *corePlugin = CompPlugin::load ("core");
- if (!corePlugin)
- {
- compLogMessage ("core", CompLogLevelFatal,
- "Couldn't load core plugin");
- return false;
- }
-
- if (!CompPlugin::push (corePlugin))
- {
- compLogMessage ("core", CompLogLevelFatal,
- "Couldn't activate core plugin");
- return false;
- }
-
- CompPrivate p;
- p.uval = CORE_ABIVERSION;
- storeValue ("core_ABI", p);
-
- vList.push_back ("core");
-
- priv->plugin.set (CompOption::TypeString, vList);
-
dpy = priv->dpy = XOpenDisplay (name);
if (!priv->dpy)
{
@@ -4363,6 +4440,8 @@ CompScreen::init (const char *name)
} while (event.type != DestroyNotify);
}
+ modHandler->updateModifierMappings ();
+
CompScreen::checkForError (dpy);
XGrabServer (dpy);
@@ -4391,9 +4470,6 @@ CompScreen::init (const char *name)
return false;
}
- priv->vpSize.setWidth (priv->optionGetHsize ());
- priv->vpSize.setHeight (priv->optionGetVsize ());
-
for (i = 0; i < SCREEN_EDGE_NUM; i++)
{
priv->screenEdge[i].id = None;
@@ -4470,24 +4546,6 @@ CompScreen::init (const char *name)
priv->getDesktopHints ();
- /* TODO: bailout properly when objectInitPlugins fails */
- assert (CompPlugin::screenInitPlugins (this));
-
- XQueryTree (dpy, priv->root,
- &rootReturn, &parentReturn,
- &children, &nchildren);
-
- for (unsigned int i = 0; i < nchildren; i++)
- new CompWindow (children[i], i ? children[i - 1] : 0);
-
- foreach (CompWindow *w, priv->windows)
- {
- if (w->isViewable ())
- w->priv->activeNum = priv->activeNum++;
- }
-
- XFree (children);
-
attrib.override_redirect = 1;
attrib.event_mask = PropertyChangeMask;
@@ -4535,6 +4593,47 @@ CompScreen::init (const char *name)
priv->setAudibleBell (priv->optionGetAudibleBell ());
+ priv->pingTimer.setTimes (priv->optionGetPingDelay (),
+ priv->optionGetPingDelay () + 500);
+
+ priv->pingTimer.start ();
+
+ priv->addScreenActions ();
+
+ priv->initialized = true;
+
+ /* TODO: Bailout properly when screenInitPlugins fails
+ * TODO: It would be nicer if this line could mean
+ * "init all the screens", but unfortunately it only inits
+ * plugins loaded on the command line screen's and then
+ * we need to call updatePlugins () to init the remaining
+ * screens from option changes */
+ assert (CompPlugin::screenInitPlugins (this));
+
+ /* The active plugins list might have been changed - load any
+ * new plugins */
+
+ if (priv->dirtyPluginList)
+ priv->updatePlugins ();
+
+ priv->vpSize.setWidth (priv->optionGetHsize ());
+ priv->vpSize.setHeight (priv->optionGetVsize ());
+
+ XQueryTree (dpy, priv->root,
+ &rootReturn, &parentReturn,
+ &children, &nchildren);
+
+ for (unsigned int i = 0; i < nchildren; i++)
+ new CompWindow (children[i], i ? children[i - 1] : 0);
+
+ foreach (CompWindow *w, priv->windows)
+ {
+ if (w->isViewable ())
+ w->priv->activeNum = priv->activeNum++;
+ }
+
+ XFree (children);
+
XGetInputFocus (dpy, &focus, &revertTo);
/* move input focus to root window so that we get a FocusIn event when
@@ -4556,14 +4655,6 @@ CompScreen::init (const char *name)
focusDefaultWindow ();
}
- priv->pingTimer.setTimes (priv->optionGetPingDelay (),
- priv->optionGetPingDelay () + 500);
-
- priv->pingTimer.start ();
-
- priv->initialized = true;
- priv->addScreenActions ();
-
return true;
}
diff --git a/src/window.cpp b/src/window.cpp
index dd8d24d..93b5c2c 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -1345,6 +1345,28 @@ CompWindow::unmap ()
if (priv->unmapRefCnt > 0)
return;
+ if (priv->managed && !priv->placed)
+ {
+ XWindowChanges xwc;
+ unsigned int xwcm;
+ int gravity = priv->sizeHints.win_gravity;
+
+ /* revert gravity adjustment made at MapNotify time */
+ xwc.x = priv->serverGeometry.x ();
+ xwc.y = priv->serverGeometry.y ();
+ xwc.width = 0;
+ xwc.height = 0;
+
+ xwcm = priv->adjustConfigureRequestForGravity (&xwc,
+ CWX | CWY,
+ gravity,
+ -1);
+ if (xwcm)
+ configureXWindow (xwcm, &xwc);
+
+ priv->managed = false;
+ }
+
if (priv->struts)
screen->updateWorkarea ();
@@ -1750,8 +1772,65 @@ void
CompWindow::validateResizeRequest (unsigned int &mask,
XWindowChanges *xwc,
unsigned int source)
+{
WRAPABLE_HND_FUNC (5, validateResizeRequest, mask, xwc, source)
+ if (!(priv->type & (CompWindowTypeDockMask |
+ CompWindowTypeFullscreenMask |
+ CompWindowTypeUnknownMask)))
+ {
+ if (mask & CWY)
+ {
+ int min, max;
+
+ min = screen->workArea ().y () + priv->input.top;
+ max = screen->workArea ().bottom ();
+
+ if (priv->state & CompWindowStateStickyMask &&
+ (xwc->y < min || xwc->y > max))
+ {
+ xwc->y = priv->serverGeometry.y ();
+ }
+ else
+ {
+ min -= screen->vp ().y () * screen->height ();
+ max += (screen->vpSize ().height () - screen->vp ().y () - 1) *
+ screen->height ();
+
+ if (xwc->y < min)
+ xwc->y = min;
+ else if (xwc->y > max)
+ xwc->y = max;
+ }
+ }
+
+ if (mask & CWX)
+ {
+ int min, max;
+
+ min = screen->workArea ().x () + priv->input.left;
+ max = screen->workArea ().right ();
+
+ if (priv->state & CompWindowStateStickyMask &&
+ (xwc->x < min || xwc->x > max))
+ {
+ xwc->x = priv->serverGeometry.x ();
+ }
+ else
+ {
+ min -= screen->vp ().x () * screen->width ();
+ max += (screen->vpSize ().width () - screen->vp ().x () - 1) *
+ screen->width ();
+
+ if (xwc->x < min)
+ xwc->x = min;
+ else if (xwc->x > max)
+ xwc->x = max;
+ }
+ }
+ }
+}
+
void
CompWindow::resizeNotify (int dx,
int dy,
@@ -2741,7 +2820,8 @@ PrivateWindow::addWindowSizeChanges (XWindowChanges *xwc,
unsigned int
PrivateWindow::adjustConfigureRequestForGravity (XWindowChanges *xwc,
unsigned int xwcm,
- int gravity)
+ int gravity,
+ int direction)
{
int newX, newY;
unsigned int mask = 0;
@@ -2756,26 +2836,26 @@ PrivateWindow::adjustConfigureRequestForGravity (XWindowChanges *xwc,
case WestGravity:
case SouthWestGravity:
if (xwcm & CWX)
- newX += priv->input.left;
+ newX += priv->input.left * direction;
break;
case NorthGravity:
case CenterGravity:
case SouthGravity:
if (xwcm & CWX)
- newX -= xwc->width / 2 - priv->input.left +
- (priv->input.left + priv->input.right) / 2;
+ newX -= (xwc->width / 2 - priv->input.left +
+ (priv->input.left + priv->input.right) / 2) * direction;
else
- newX -= (xwc->width - priv->serverGeometry.width ());
+ newX -= (xwc->width - priv->serverGeometry.width ()) * direction;
break;
case NorthEastGravity:
case EastGravity:
case SouthEastGravity:
if (xwcm & CWX)
- newX -= xwc->width + priv->input.right;
+ newX -= xwc->width + priv->input.right * direction;
else
- newX -= xwc->width - priv->serverGeometry.width ();
+ newX -= (xwc->width - priv->serverGeometry.width ()) * direction;
break;
case StaticGravity:
@@ -2791,26 +2871,26 @@ PrivateWindow::adjustConfigureRequestForGravity (XWindowChanges *xwc,
case NorthGravity:
case NorthEastGravity:
if (xwcm & CWY)
- newY = xwc->y + priv->input.top;
+ newY = xwc->y + priv->input.top * direction;
break;
case WestGravity:
case CenterGravity:
case EastGravity:
if (xwcm & CWY)
- newY -= xwc->height / 2 - priv->input.top +
- (priv->input.top + priv->input.bottom) / 2;
+ newY -= (xwc->height / 2 - priv->input.top +
+ (priv->input.top + priv->input.bottom) / 2) * direction;
else
- newY -= (xwc->height - priv->serverGeometry.height ()) / 2;
+ newY -= ((xwc->height - priv->serverGeometry.height ()) / 2) * direction;
break;
case SouthWestGravity:
case SouthGravity:
case SouthEastGravity:
if (xwcm & CWY)
- newY -= xwc->height + priv->input.bottom;
+ newY -= xwc->height + priv->input.bottom * direction;
else
- newY -= xwc->height - priv->serverGeometry.height ();
+ newY -= (xwc->height - priv->serverGeometry.height ()) * direction;
break;
case StaticGravity:
@@ -2877,62 +2957,7 @@ CompWindow::moveResize (XWindowChanges *xwc,
}
}
- xwcm |= priv->adjustConfigureRequestForGravity (xwc, xwcm, gravity);
-
- if (!(priv->type & (CompWindowTypeDockMask |
- CompWindowTypeFullscreenMask |
- CompWindowTypeUnknownMask)))
- {
- if (xwcm & CWY)
- {
- int min, max;
-
- min = screen->workArea ().y () + priv->input.top;
- max = screen->workArea ().bottom ();
-
- if (priv->state & CompWindowStateStickyMask &&
- (xwc->y < min || xwc->y > max))
- {
- xwc->y = priv->serverGeometry.y ();
- }
- else
- {
- min -= screen->vp ().y () * screen->height ();
- max += (screen->vpSize ().height () - screen->vp ().y () - 1) *
- screen->height ();
-
- if (xwc->y < min)
- xwc->y = min;
- else if (xwc->y > max)
- xwc->y = max;
- }
- }
-
- if (xwcm & CWX)
- {
- int min, max;
-
- min = screen->workArea ().x () + priv->input.left;
- max = screen->workArea ().right ();
-
- if (priv->state & CompWindowStateStickyMask &&
- (xwc->x < min || xwc->x > max))
- {
- xwc->x = priv->serverGeometry.x ();
- }
- else
- {
- min -= screen->vp ().x () * screen->width ();
- max += (screen->vpSize ().width () - screen->vp ().x () - 1) *
- screen->width ();
-
- if (xwc->x < min)
- xwc->x = min;
- else if (xwc->x > max)
- xwc->x = max;
- }
- }
- }
+ xwcm |= priv->adjustConfigureRequestForGravity (xwc, xwcm, gravity, 1);
validateResizeRequest (xwcm, xwc, source);
@@ -3151,10 +3176,10 @@ CompWindow::lower ()
the click-to-focus option is on */
if ((screen->getOption ("click_to_focus")->value ().b ()))
{
- Window aboveId = next ? next->id () : None;
+ Window aboveWindowId = prev ? prev->id () : None;
screen->unhookWindow (this);
CompWindow *focusedWindow = screen->priv->focusTopMostWindow ();
- screen->insertWindow (this , aboveId);
+ screen->insertWindow (this , aboveWindowId);
/* if the newly focused window is a desktop window,
give the focus back to w */
@@ -3191,6 +3216,21 @@ PrivateWindow::findValidStackSiblingBelow (CompWindow *w,
{
CompWindow *lowest, *last, *p;
+ /* check whether we're allowed to stack under a sibling by finding
+ * the above 'sibling' and checking whether or not we're allowed
+ * to stack under that - if not, then there is no valid sibling
+ * underneath it */
+
+ for (p = sibling; p; p = p->next)
+ {
+ if (!avoidStackingRelativeTo (p))
+ {
+ if (!validSiblingBelow (p, w))
+ return NULL;
+ break;
+ }
+ }
+
/* get lowest sibling we're allowed to stack above */
lowest = last = findLowestSiblingBelow (w);
@@ -3289,14 +3329,19 @@ CompWindow::updateAttributes (CompStackingUpdateMode stackingMode)
if (p->priv->id == screen->activeWindow ())
break;
- /* window is above active window so we should lower it */
- if (p)
+ /* window is above active window so we should lower it,
+ * assuing that is allowed (if, for example, our window has
+ * the "above" state, then lowering beneath the active
+ * window may not be allowed). */
+ if (p && PrivateWindow::validSiblingBelow (p, this))
+ {
p = PrivateWindow::findValidStackSiblingBelow (sibling, p);
- /* if we found a valid sibling under the active window, it's
- our new sibling we want to stack above */
- if (p)
- sibling = p;
+ /* if we found a valid sibling under the active window, it's
+ our new sibling we want to stack above */
+ if (p)
+ sibling = p;
+ }
}
mask |= priv->addWindowStackChanges (&xwc, sibling);
@@ -4587,13 +4632,13 @@ PrivateWindow::processMap ()
XWindowChanges xwc;
unsigned int xwcm;
- /* adjust for gravity */
+ /* adjust for gravity, but only for frame size */
xwc.x = priv->serverGeometry.x ();
xwc.y = priv->serverGeometry.y ();
- xwc.width = priv->serverGeometry.width ();
- xwc.height = priv->serverGeometry.height ();
+ xwc.width = 0;
+ xwc.height = 0;
- xwcm = adjustConfigureRequestForGravity (&xwc, CWX | CWY, gravity);
+ xwcm = adjustConfigureRequestForGravity (&xwc, CWX | CWY, gravity, 1);
window->validateResizeRequest (xwcm, &xwc, ClientTypeApplication);