summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/eventsource.cpp6
-rw-r--r--src/plugin.cpp7
-rw-r--r--src/privateeventsource.h5
-rw-r--r--src/privatescreen.h4
-rw-r--r--src/privatewindow.h19
-rw-r--r--src/screen.cpp6
-rw-r--r--src/window.cpp155
7 files changed, 120 insertions, 82 deletions
diff --git a/src/eventsource.cpp b/src/eventsource.cpp
index 2973d17..cb35773 100644
--- a/src/eventsource.cpp
+++ b/src/eventsource.cpp
@@ -26,10 +26,12 @@
#include "privatescreen.h"
-Glib::RefPtr <CompEventSource>
+//Glib::RefPtr <CompEventSource>
+CompEventSource*
CompEventSource::create ()
{
- return Glib::RefPtr <CompEventSource> (new CompEventSource ());
+ // return Glib::RefPtr <CompEventSource> (new CompEventSource ());
+ return new CompEventSource ();
}
sigc::connection
diff --git a/src/plugin.cpp b/src/plugin.cpp
index 2dabcbd..16dfa7d 100644
--- a/src/plugin.cpp
+++ b/src/plugin.cpp
@@ -154,7 +154,12 @@ dlloaderLoadPlugin (CompPlugin *p,
return false;
}
- dlhand = dlopen (file.c_str (), RTLD_LAZY | RTLD_GLOBAL);
+ int open_flags = RTLD_LAZY | RTLD_GLOBAL;
+#ifdef DEBUG
+ // Do not unload the library during dlclose.
+ open_flags |= RTLD_NODELETE;
+#endif
+ dlhand = dlopen (file.c_str (), open_flags);
if (dlhand)
{
PluginGetInfoProc getInfo;
diff --git a/src/privateeventsource.h b/src/privateeventsource.h
index 92eda18..d629582 100644
--- a/src/privateeventsource.h
+++ b/src/privateeventsource.h
@@ -32,7 +32,8 @@ class CompEventSource:
public:
static
- Glib::RefPtr <CompEventSource> create ();
+ // Glib::RefPtr <CompEventSource> create ();
+ CompEventSource* create ();
sigc::connection connect (const sigc::slot <bool> &slot);
@@ -43,7 +44,7 @@ class CompEventSource:
bool dispatch (sigc::slot_base *slot);
bool callback ();
- explicit CompEventSource ();
+ CompEventSource ();
virtual ~CompEventSource ();
private:
diff --git a/src/privatescreen.h b/src/privatescreen.h
index b6cd6b6..e0798c3 100644
--- a/src/privatescreen.h
+++ b/src/privatescreen.h
@@ -302,7 +302,9 @@ class PrivateScreen :
PrivateScreen *priv;
Glib::RefPtr <Glib::MainLoop> mainloop;
- Glib::RefPtr <CompEventSource> source;
+ // See https://bugzilla.gnome.org/show_bug.cgi?id=561885
+ // Glib::RefPtr <CompEventSource> source;
+ CompEventSource* source;
Glib::RefPtr <CompTimeoutSource> timeout;
Glib::RefPtr <Glib::MainContext> ctx;
diff --git a/src/privatewindow.h b/src/privatewindow.h
index d1cf73c..a20a01c 100644
--- a/src/privatewindow.h
+++ b/src/privatewindow.h
@@ -36,10 +36,14 @@
#define WINDOW_INVISIBLE(w) \
((w)->attrib.map_state != IsViewable || \
- (w)->attrib.x + (w)->width + (w)->output.right <= 0 || \
- (w)->attrib.y + (w)->height + (w)->output.bottom <= 0 || \
- (w)->attrib.x - (w)->output.left >= (int) screen->width () || \
- (w)->attrib.y - (w)->output.top >= (int) screen->height () )
+ (w)->geometry.x () + (w)->geometry.width () + \
+ (w)->geometry.border () * 2 + (w)->output.right <= 0 || \
+ (w)->geometry.y () + (w)->geometry.height () + \
+ (w)->geometry.border () * 2 + (w)->output.bottom <= 0 || \
+ (w)->geometry.x () - \
+ (w)->output.left >= (int) screen->width () || \
+ (w)->geometry.y () - \
+ (w)->output.top >= (int) screen->height () )
typedef CompWindowExtents CompFullscreenMonitorSet;
@@ -223,6 +227,13 @@ class PrivateWindow {
Window wrapper;
unsigned int mapNum;
unsigned int activeNum;
+
+ /* Don't use this for determining
+ * the window geometry because we
+ * read into this out of sync with
+ * ConfigureNotify events to determine
+ * the class and override redirect state
+ */
XWindowAttributes attrib;
CompWindow::Geometry geometry;
CompWindow::Geometry serverGeometry;
diff --git a/src/screen.cpp b/src/screen.cpp
index 2ab2b02..a0b284d 100644
--- a/src/screen.cpp
+++ b/src/screen.cpp
@@ -2036,9 +2036,9 @@ PrivateScreen::configure (XConfigureEvent *ce)
priv->attrib.height = ce->height;
}
- priv->reshape (ce->width, ce->height);
+ priv->reshape (ce->width, ce->height);
- priv->detectOutputDevices ();
+ priv->detectOutputDevices ();
}
void
@@ -4663,6 +4663,8 @@ PrivateScreen::PrivateScreen (CompScreen *screen) :
boost::bind (&PrivateScreen::handleStartupSequenceTimeout, this));
startupSequenceTimer.setTimes (1000, 1500);
+ memset (&history, 0, sizeof (Window) * ACTIVE_WINDOW_HISTORY_NUM);
+
optionSetCloseWindowKeyInitiate (CompScreen::closeWin);
optionSetCloseWindowButtonInitiate (CompScreen::closeWin);
optionSetRaiseWindowKeyInitiate (CompScreen::raiseWin);
diff --git a/src/window.cpp b/src/window.cpp
index f30f28a..d182727 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -796,11 +796,11 @@ PrivateWindow::updateFrameWindow ()
xev.event = screen->root ();
xev.window = priv->frame;
- xev.x = x;
- xev.y = y;
- xev.width = width;
- xev.height = height;
- xev.border_width = window->priv->attrib.border_width;
+ xev.x = serverGeometry.x ();
+ xev.y = serverGeometry.y ();
+ xev.width = serverGeometry.width ();
+ xev.height = serverGeometry.height ();
+ xev.border_width = serverGeometry.border ();
xev.above = (window->prev) ? ROOTPARENT (window->prev) : None;
xev.override_redirect = window->priv->attrib.override_redirect;
@@ -901,8 +901,8 @@ PrivateWindow::rectsToRegion (unsigned int n, XRectangle *rects)
for (unsigned int i = 0; i < n; i++)
{
- x1 = rects[i].x + priv->attrib.border_width;
- y1 = rects[i].y + priv->attrib.border_width;
+ x1 = rects[i].x + priv->geometry.border ();
+ y1 = rects[i].y + priv->geometry.border ();
x2 = x1 + rects[i].width;
y2 = y1 + rects[i].height;
@@ -917,10 +917,10 @@ PrivateWindow::rectsToRegion (unsigned int n, XRectangle *rects)
if (y1 < y2 && x1 < x2)
{
- x1 += priv->attrib.x;
- y1 += priv->attrib.y;
- x2 += priv->attrib.x;
- y2 += priv->attrib.y;
+ x1 += priv->geometry.x ();
+ y1 += priv->geometry.y ();
+ x2 += priv->geometry.x ();
+ y2 += priv->geometry.y ();
ret += CompRect (x1, y1, x2 - x1, y2 - y1);
}
@@ -955,6 +955,7 @@ PrivateWindow::updateRegion ()
}
+ /* FIXME: That doesn't look right */
r.x = -priv->attrib.border_width;
r.y = -priv->attrib.border_width;
r.width = priv->width + priv->attrib.border_width;
@@ -1229,10 +1230,10 @@ CompWindow::sendConfigureNotify ()
xev.window = priv->id;
/* normally we should never send configure notify events to override
- redirect windows but if they support the _NET_WM_SYNC_REQUEST
- protocol we need to do this when the window is mapped. however the
- only way we can make sure that the attributes we send are correct
- and is to grab the server. */
+ * redirect windows but if they support the _NET_WM_SYNC_REQUEST
+ * protocol we need to do this when the window is mapped. however the
+ * only way we can make sure that the attributes we send are correct
+ * and is to grab the server. */
if (priv->attrib.override_redirect)
{
XWindowAttributes attrib;
@@ -1320,8 +1321,11 @@ CompWindow::map ()
{
/* been shaded */
if (!priv->height)
- resize (priv->attrib.x, priv->attrib.y, priv->attrib.width,
- ++priv->attrib.height - 1, priv->attrib.border_width);
+ {
+ priv->geometry.setHeight (priv->geometry.height () + 1);
+ resize (priv->geometry.x (), priv->geometry.y (), priv->geometry.width (),
+ priv->geometry.height () - 1, priv->geometry.border ());
+ }
}
}
@@ -1394,9 +1398,9 @@ CompWindow::unmap ()
priv->invisible = true;
if (priv->shaded && priv->height)
- resize (priv->attrib.x, priv->attrib.y,
- priv->attrib.width, ++priv->attrib.height - 1,
- priv->attrib.border_width);
+ resize (priv->geometry.x (), priv->geometry.y (),
+ priv->geometry.width (), priv->geometry.height () - 1,
+ priv->geometry.border ());
screen->priv->updateClientList ();
@@ -1475,20 +1479,14 @@ CompWindow::resize (CompWindow::Geometry gm)
if (priv->shaded)
ph = 0;
- dx = gm.x () - priv->attrib.x;
- dy = gm.y () - priv->attrib.y;
- dwidth = gm.width () - priv->attrib.width;
- dheight = gm.height () - priv->attrib.height;
-
- priv->attrib.x = gm.x ();
- priv->attrib.y = gm.y ();
- priv->attrib.width = gm.width ();
- priv->attrib.height = gm.height ();
- priv->attrib.border_width = gm.border ();
+ dx = gm.x () - priv->geometry.x ();
+ dy = gm.y () - priv->geometry.y ();
+ dwidth = gm.width () - priv->geometry.width ();
+ dheight = gm.height () - priv->geometry.height ();
- priv->geometry.set (priv->attrib.x, priv->attrib.y,
- priv->attrib.width, priv->attrib.height,
- priv->attrib.border_width);
+ priv->geometry.set (gm.x (), gm.y (),
+ gm.width (), gm.height (),
+ gm.border ());
priv->width = pw;
priv->height = ph;
@@ -1505,8 +1503,8 @@ CompWindow::resize (CompWindow::Geometry gm)
{
int dx, dy;
- dx = gm.x () - priv->attrib.x;
- dy = gm.y () - priv->attrib.y;
+ dx = gm.x () - priv->geometry.x ();
+ dy = gm.y () - priv->geometry.y ();
move (dx, dy);
}
@@ -1715,11 +1713,8 @@ CompWindow::move (int dx,
{
if (dx || dy)
{
- priv->attrib.x += dx;
- priv->attrib.y += dy;
-
- priv->geometry.setX (priv->attrib.x);
- priv->geometry.setY (priv->attrib.y);
+ priv->geometry.setX (priv->geometry.x () + dx);
+ priv->geometry.setY (priv->geometry.y () + dy);
priv->region.translate (dx, dy);
priv->inputRegion.translate (dx, dy);
@@ -1735,12 +1730,12 @@ CompWindow::move (int dx,
void
CompWindow::syncPosition ()
{
- priv->serverGeometry.setX (priv->attrib.x);
- priv->serverGeometry.setY (priv->attrib.y);
+ priv->serverGeometry.setX (priv->geometry.x ());
+ priv->serverGeometry.setY (priv->geometry.y ());
XMoveWindow (screen->dpy (), ROOTPARENT (this),
- priv->attrib.x - priv->input.left,
- priv->attrib.y - priv->input.top);
+ priv->geometry.x () - priv->input.left,
+ priv->geometry.y () - priv->input.top);
if (priv->frame)
{
@@ -1770,10 +1765,10 @@ CompWindow::focus ()
if (!priv->shaded && (priv->state & CompWindowStateHiddenMask))
return false;
- if (priv->attrib.x + priv->width <= 0 ||
- priv->attrib.y + priv->height <= 0 ||
- priv->attrib.x >= (int) screen->width ()||
- priv->attrib.y >= (int) screen->height ())
+ if (priv->geometry.x () + priv->width <= 0 ||
+ priv->geometry.y () + priv->height <= 0 ||
+ priv->geometry.x () >= (int) screen->width ()||
+ priv->geometry.y () >= (int) screen->height ())
return false;
return true;
@@ -3851,9 +3846,12 @@ PrivateWindow::show ()
XMapWindow (screen->dpy (), frame);
if (height)
- window->resize (attrib.x, attrib.y,
- attrib.width, ++attrib.height - 1,
- attrib.border_width);
+ {
+ priv->geometry.setHeight (priv->geometry.height () + 1);
+ window->resize (geometry.x (), geometry.y (),
+ geometry.width (), geometry.height () - 1,
+ geometry.border ());
+ }
return;
}
@@ -4509,7 +4507,7 @@ CompWindow::getMovementForOffset (CompPoint offset)
}
else
{
- m = priv->attrib.x + offX;
+ m = priv->geometry.x () + offX;
if (m - priv->input.left < (int) s->width () - vWidth)
rv.setX (offX + vWidth);
else if (m + priv->width + priv->input.right > vWidth)
@@ -4524,7 +4522,7 @@ CompWindow::getMovementForOffset (CompPoint offset)
}
else
{
- m = priv->attrib.y + offY;
+ m = priv->geometry.y () + offY;
if (m - priv->input.top < (int) s->height () - vHeight)
rv.setY (offY + vHeight);
else if (m + priv->height + priv->input.bottom > vHeight)
@@ -4756,6 +4754,7 @@ void
PrivateWindow::processMap ()
{
bool allowFocus;
+ bool initiallyMinimized;
CompStackingUpdateMode stackingMode;
priv->initialViewport = screen->vp ();
@@ -4798,6 +4797,9 @@ PrivateWindow::processMap ()
priv->placed = true;
}
+ initiallyMinimized = (priv->hints &&
+ priv->hints->initial_state == IconicState &&
+ !window->minimized ());
allowFocus = allowWindowFocus (NO_FOCUS_MASK, 0);
if (!allowFocus && (priv->type & ~NO_FOCUS_MASK))
@@ -4807,9 +4809,27 @@ PrivateWindow::processMap ()
window->updateAttributes (stackingMode);
- if (window->minimized ())
+ if (window->minimized () && !initiallyMinimized)
window->unminimize ();
+ if (!initiallyMinimized)
+ {
+ if (allowFocus && !window->onCurrentDesktop ());
+ screen->priv->setCurrentDesktop (priv->desktop);
+
+ if (!(priv->state & CompWindowStateHiddenMask))
+ show ();
+
+ if (allowFocus)
+ window->moveInputFocusTo ();
+ }
+ else
+ {
+ window->minimize ();
+ window->changeState (window->state () | CompWindowStateHiddenMask);
+ screen->priv->updateClientList ();
+ }
+
screen->leaveShowDesktopMode (window);
if (allowFocus && !window->onCurrentDesktop ())
@@ -5047,8 +5067,8 @@ CompWindow::moveToViewportPosition (int x,
y -= screen->vp ().y () * screen->height ();
}
- tx = x - priv->attrib.x;
- ty = y - priv->attrib.y;
+ tx = x - priv->geometry.x ();
+ ty = y - priv->geometry.y ();
if (tx || ty)
{
@@ -5068,7 +5088,7 @@ CompWindow::moveToViewportPosition (int x,
if (screen->vpSize ().width ()!= 1)
{
- m = priv->attrib.x + tx;
+ m = priv->geometry.x () + tx;
if (m - priv->output.left < (int) screen->width () - vWidth)
wx = tx + vWidth;
@@ -5078,7 +5098,7 @@ CompWindow::moveToViewportPosition (int x,
if (screen->vpSize ().height () != 1)
{
- m = priv->attrib.y + ty;
+ m = priv->geometry.y () + ty;
if (m - priv->output.top < (int) screen->height () - vHeight)
wy = ty + vHeight;
@@ -5327,7 +5347,7 @@ CompWindow::CompWindow (Window aboveId,
if (priv->attrib.c_class != InputOnly)
{
- priv->region = CompRegion (priv->attrib.x, priv->attrib.y,
+ priv->region = CompRegion (priv->geometry.x (), priv->geometry.y (),
priv->width, priv->height);
priv->inputRegion = priv->region;
@@ -5459,9 +5479,12 @@ CompWindow::CompWindow (Window aboveId,
priv->updateIconGeometry ();
if (priv->shaded)
- resize (priv->attrib.x, priv->attrib.y,
- priv->attrib.width, ++priv->attrib.height - 1,
- priv->attrib.border_width);
+ {
+ priv->geometry.setHeight (priv->geometry.height () + 1);
+ resize (priv->geometry.x (), priv->geometry.y (),
+ priv->geometry.width (), priv->geometry.height () - 1,
+ priv->geometry.border ());
+ }
if (priv->attrib.map_state == IsViewable)
{
@@ -5857,14 +5880,6 @@ PrivateWindow::reparent ()
return false;
}
- /* Since we have read directly to our XWindowAttributes
- * we need to update the size of a window since it might
- * have changed during the reparent
- */
-
- window->resize (attrib.x, attrib.y, attrib.width, attrib.height,
- attrib.border_width);
-
if (attrib.override_redirect)
return false;