summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <smspillaz@gmail.com>2010-12-13 21:16:43 +0800
committerSam Spilsbury <smspillaz@gmail.com>2010-12-13 21:16:43 +0800
commitaf62da3851ad053b5139ad51f77477d57e2a9646 (patch)
treea3f22f478b12c6f855453352e5af38803d413d60
parentabb087437f97baa09046b4d081c10a71de5f97ad (diff)
parent8dd7395415306d0e060ab48584e084eeef64d918 (diff)
downloadcompiz-with-glib-mainloop-af62da3851ad053b5139ad51f77477d57e2a9646.tar.gz
compiz-with-glib-mainloop-af62da3851ad053b5139ad51f77477d57e2a9646.tar.bz2
Merge git://git.compiz.org/compiz/core into glibmm-experimental
-rw-r--r--cmake/CMakeLists.txt1
-rw-r--r--cmake/CompizPlugin.cmake4
-rw-r--r--plugins/decor/src/decor.cpp34
-rw-r--r--plugins/decor/src/decor.h3
-rw-r--r--plugins/resize/src/resize.cpp159
-rw-r--r--plugins/resize/src/resize.h2
-rw-r--r--src/main.cpp4
7 files changed, 197 insertions, 10 deletions
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 71130a8..887d86e 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -18,6 +18,7 @@ list (APPEND _PluginExtensionFiles
if (USE_GCONF)
list (APPEND _files CompizGconf.cmake)
+ list (APPEND _PluginExtensionFiles plugin_extensions/CompizGenGconf.cmake)
endif (USE_GCONF)
install (
diff --git a/cmake/CompizPlugin.cmake b/cmake/CompizPlugin.cmake
index 047ddd7..10a4a6f 100644
--- a/cmake/CompizPlugin.cmake
+++ b/cmake/CompizPlugin.cmake
@@ -108,7 +108,9 @@ macro (_prepare_directories)
set (PLUGIN_PKGDIR ${libdir}/pkgconfig)
set (PLUGIN_XMLDIR ${datadir}/compiz)
-
+ if (NOT "${CMAKE_BUILD_TYPE}")
+ set (CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Build type (Debug/Release/RelWithDebInfo/MinSizeRe)" FORCE)
+ endif (NOT "${CMAKE_BUILD_TYPE}")
elseif ("${COMPIZ_PLUGIN_INSTALL_TYPE}" STREQUAL "compiz" OR
"$ENV{BUILD_GLOBAL}" STREQUAL "true")
set (PLUGIN_BUILDTYPE global)
diff --git a/plugins/decor/src/decor.cpp b/plugins/decor/src/decor.cpp
index 511d99b..1c5b2cd 100644
--- a/plugins/decor/src/decor.cpp
+++ b/plugins/decor/src/decor.cpp
@@ -1247,10 +1247,28 @@ DecorWindow::updateWindowRegions ()
void
DecorWindow::windowNotify (CompWindowNotify n)
{
- if (n == CompWindowNotifyReparent)
+ switch (n)
{
- DecorWindow::get (window)->update (true);
- window->windowNotifySetEnabled (this, false);
+ case CompWindowNotifyReparent:
+ update (true);
+ /* We get the notification for shade before the window is
+ * actually resized which means that calling update ->
+ * damageOutputExtents here will not do anything useful for us
+ * so we need to track when windows are (un)shading and then wait
+ * for the following resize notification to actually
+ * update their decoration (since at this point they would have
+ * been resized)
+ */
+ case CompWindowNotifyShade:
+ shading = true;
+ unshading = false;
+ break;
+ case CompWindowNotifyUnshade:
+ unshading = true;
+ shading = false;
+ break;
+ default:
+ break;
}
window->windowNotify (n);
@@ -1625,6 +1643,13 @@ DecorWindow::moveNotify (int dx, int dy, bool immediate)
bool
DecorWindow::resizeTimeout ()
{
+ if (shading || unshading)
+ {
+ shading = false;
+ unshading = false;
+
+ updateDecoration ();
+ }
update (true);
return false;
}
@@ -1778,7 +1803,8 @@ DecorWindow::DecorWindow (CompWindow *w) :
outputFrame (None),
pixmapFailed (false),
regions (),
- updateReg (true)
+ updateReg (true),
+ unshading (false)
{
WindowInterface::setHandler (window);
diff --git a/plugins/decor/src/decor.h b/plugins/decor/src/decor.h
index 9545807..f382639 100644
--- a/plugins/decor/src/decor.h
+++ b/plugins/decor/src/decor.h
@@ -228,6 +228,9 @@ class DecorWindow :
CompTimer resizeUpdate;
CompTimer moveUpdate;
+
+ bool unshading;
+ bool shading;
};
class DecorPluginVTable :
diff --git a/plugins/resize/src/resize.cpp b/plugins/resize/src/resize.cpp
index a8d3c4f..a2b3bb8 100644
--- a/plugins/resize/src/resize.cpp
+++ b/plugins/resize/src/resize.cpp
@@ -183,6 +183,124 @@ ResizeScreen::finishResizing ()
w = NULL;
}
+#define TOUCH_LEFT 1
+#define TOUCH_RIGHT 2
+#define TOUCH_TOP 3
+#define TOUCH_BOTTOM 4
+
+static unsigned int
+findTouchingOutput (int touchPoint, unsigned int side)
+{
+ for (unsigned int i = 0; i < screen->outputDevs ().size (); i++)
+ {
+ CompOutput &o = screen->outputDevs ().at (i);
+ if (side == TOUCH_LEFT)
+ {
+ if (o.left () == touchPoint)
+ return i;
+ }
+ if (side == TOUCH_RIGHT)
+ {
+ if (o.right () == touchPoint)
+ return i;
+ }
+ if (side == TOUCH_TOP)
+ {
+ if (o.top () == touchPoint)
+ return i;
+ }
+ if (side == TOUCH_BOTTOM)
+ {
+ if (o.bottom () == touchPoint)
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+static void
+getPointForTp (unsigned int tp, unsigned int output, int &op, int &wap)
+{
+ CompRect og = CompRect (screen->outputDevs ().at (output));
+ CompRect wag = screen->outputDevs ().at (output).workArea ();
+
+ switch (tp)
+ {
+ case TOUCH_LEFT:
+ op = og.right ();
+ wap = wag.right ();
+ break;
+ case TOUCH_RIGHT:
+ op = og.left ();
+ wap = wag.left ();
+ break;
+ case TOUCH_TOP:
+ op = og.bottom ();
+ wap = wag.bottom ();
+ break;
+ case TOUCH_BOTTOM:
+ op = og.top ();
+ wap = wag.top ();
+ break;
+ default:
+ return;
+ }
+}
+
+/* Be a little bit intelligent about how we calculate
+ * the workarea. Basically we want to be enclosed in
+ * any area that is obstructed by panels, but not
+ * where two outputs meet
+ *
+ * Also, it does not make sense to resize over
+ * non-touching outputs, so detect that case too
+ * */
+
+static int
+getOutputForEdge (int windowOutput, unsigned int touch, bool skipFirst)
+{
+ int op, wap;
+ int ret = windowOutput;
+
+ getPointForTp (touch, windowOutput, op, wap);
+
+ if ((op == wap) || skipFirst)
+ {
+ int co = windowOutput;
+
+ do
+ {
+ int oco = co;
+
+ co = findTouchingOutput (op, touch);
+
+ /* Could not find a leftmost output from here
+ * so we must have hit the edge of the universe */
+ if (co == -1)
+ {
+ ret = oco;
+ co = -1;
+ break;
+ }
+
+ getPointForTp (touch, co, op, wap);
+
+ /* There is something in the way here.... */
+ if (op != wap)
+ {
+ ret = co;
+ co = -1;
+ }
+ }
+ while (co != -1);
+ }
+
+ fprintf (stderr, "constraining to %i\n", ret);
+
+ return ret;
+}
+
static bool
resizeInitiate (CompAction *action,
CompAction::State state,
@@ -356,12 +474,46 @@ resizeInitiate (CompAction *action,
if (sourceExternalApp)
{
int output = w->outputDevice ();
+ int lco, tco, bco, rco;
+ bool sl = screen->outputDevs ().at (output).workArea ().left () >
+ w->serverGeometry ().left ();
+ bool sr = screen->outputDevs ().at (output).workArea ().right () <
+ w->serverGeometry ().right ();
+ bool st = screen->outputDevs ().at (output).workArea ().top () >
+ w->serverGeometry ().top ();
+ bool sb = screen->outputDevs ().at (output).workArea ().bottom () <
+ w->serverGeometry ().bottom ();
+
+ lco = tco = bco = rco = output;
+
/* 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 ();
+
+ lco = getOutputForEdge (output, TOUCH_RIGHT, sl);
+ rco = getOutputForEdge (output, TOUCH_LEFT, sr);
+ tco = getOutputForEdge (output, TOUCH_BOTTOM, st);
+ bco = getOutputForEdge (output, TOUCH_TOP, sb);
+
+ /* Now we need to form one big rect which describes
+ * the available workarea */
+
+ int left = screen->outputDevs ().at (lco).workArea ().left ();
+ int right = screen->outputDevs ().at (rco).workArea ().right ();
+ int top = screen->outputDevs ().at (tco).workArea ().top ();
+ int bottom = screen->outputDevs ().at (bco).workArea ().bottom ();
+
+ if (rs->grabWindowWorkArea)
+ delete rs->grabWindowWorkArea;
+
+ rs->grabWindowWorkArea = new CompRect (0, 0, 0, 0);
+ rs->grabWindowWorkArea->setLeft (left);
+ rs->grabWindowWorkArea->setRight (right);
+ rs->grabWindowWorkArea->setTop (top);
+ rs->grabWindowWorkArea->setBottom (bottom);
+
+
rs->inRegionStatus = false;
rs->lastGoodHotSpotY = -1;
rs->lastGoodSize = w->serverSize ();
@@ -1523,7 +1675,8 @@ ResizeScreen::ResizeScreen (CompScreen *s) :
centeredMask (0),
releaseButton (0),
isConstrained (false),
- offWorkAreaConstrained (true)
+ offWorkAreaConstrained (true),
+ grabWindowWorkArea (NULL)
{
CompOption::Vector atomTemplate;
Display *dpy = s->dpy ();
diff --git a/plugins/resize/src/resize.h b/plugins/resize/src/resize.h
index afab4d8..59e0c71 100644
--- a/plugins/resize/src/resize.h
+++ b/plugins/resize/src/resize.h
@@ -148,7 +148,7 @@ class ResizeScreen :
CompSize lastGoodSize;
bool offWorkAreaConstrained;
- const CompRect *grabWindowWorkArea;
+ CompRect *grabWindowWorkArea;
};
class ResizeWindow :
diff --git a/src/main.cpp b/src/main.cpp
index a8e4445..066279a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -176,7 +176,9 @@ CompManager::parseArguments (int argc, char **argv)
}
CompManager::CompManager () :
- disableSm (false)
+ disableSm (false),
+ clientId (NULL),
+ displayName (NULL)
{
}