summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorangel <angel@heaven.net>2010-07-29 18:31:46 +0300
committerangel <angel@heaven.net>2010-07-29 18:31:46 +0300
commita16fa16b718c57903033e534503e55cb21faaf11 (patch)
tree876b0f6c2fb9a1413dea5998ecd1a18180de9844
parent3cb3e313a9a24685a85d3004b845908a103259b4 (diff)
downloadzcomp-a16fa16b718c57903033e534503e55cb21faaf11.tar.gz
zcomp-a16fa16b718c57903033e534503e55cb21faaf11.tar.bz2
added --zcomp flag to disable wm, fixed border width calculation
-rw-r--r--include/compiz.h1
-rw-r--r--src/event.cpp2
-rw-r--r--src/main.cpp6
-rw-r--r--src/screen.cpp40
-rw-r--r--src/window.cpp29
-rw-r--r--src/windowgeometry.cpp4
6 files changed, 60 insertions, 22 deletions
diff --git a/include/compiz.h b/include/compiz.h
index b548c16..aa942b9 100644
--- a/include/compiz.h
+++ b/include/compiz.h
@@ -87,5 +87,6 @@ logLevelToString (CompLogLevel level);
extern char *programName;
extern char **programArgv;
extern int programArgc;
+extern bool zcomp;
#endif
diff --git a/src/event.cpp b/src/event.cpp
index 1d6e21e..f764a13 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -1045,7 +1045,7 @@ CompScreen::handleEvent (XEvent *event)
w = findWindow (event->xmap.window);
if (w)
{
- if (w->priv->pendingMaps)
+ if (w->priv->pendingMaps || zcomp)
{
if (!w->priv->frame)
w->priv->reparent ();
diff --git a/src/main.cpp b/src/main.cpp
index ea8b509..bfbfc81 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -56,6 +56,7 @@ bool noDetection = false;
bool useDesktopHints = false;
bool debugOutput = false;
bool useCow = true;
+bool zcomp = false;
unsigned int pluginClassHandlerIndex = 0;
@@ -73,6 +74,7 @@ usage (void)
"[--keep-desktop-hints]\n "
"[--use-root-window] "
"[--debug] "
+ "[--zcomp] "
"[--version] "
"[--help] "
"[PLUGIN]...\n",
@@ -172,6 +174,10 @@ main (int argc, char **argv)
if (i + 1 < argc)
backgroundImage = argv[++i];
}
+ else if (!strcmp (argv[i], "--zcomp"))
+ {
+ zcomp = true;
+ }
else if (*argv[i] == '-')
{
compLogMessage ("core", CompLogLevelWarn,
diff --git a/src/screen.cpp b/src/screen.cpp
index 86ca65a..aad1411 100644
--- a/src/screen.cpp
+++ b/src/screen.cpp
@@ -1191,6 +1191,9 @@ void
PrivateScreen::setWmState (int state, Window id)
{
unsigned long data[2];
+
+ if (zcomp)
+ return;
data[0] = state;
data[1] = None;
@@ -1291,11 +1294,15 @@ PrivateScreen::getWindowState (Window id)
return state;
}
+
void
PrivateScreen::setWindowState (unsigned int state, Window id)
{
Atom data[32];
int i = 0;
+
+ if (zcomp)
+ return;
if (state & CompWindowStateModalMask)
data[i++] = Atoms::winStateModal;
@@ -4100,6 +4107,7 @@ CompScreen::init (const char *name)
unsigned int nchildren;
int defaultDepth, nvisinfo;
XSetWindowAttributes attrib;
+ int inputMask;
CompOption::Value::Vector vList;
@@ -4196,6 +4204,11 @@ CompScreen::init (const char *name)
wmSnAtom = XInternAtom (dpy, buf, 0);
currentWmSnOwner = XGetSelectionOwner (dpy, wmSnAtom);
+
+ root = XRootWindow (dpy, DefaultScreen (dpy));
+
+ if (zcomp)
+ goto select_input;
if (currentWmSnOwner != None)
{
@@ -4214,8 +4227,6 @@ CompScreen::init (const char *name)
XSelectInput (dpy, currentWmSnOwner, StructureNotifyMask);
}
- root = XRootWindow (dpy, DefaultScreen (dpy));
-
attr.override_redirect = true;
attr.event_mask = PropertyChangeMask;
#define PACKAGE "compiz_aaaaaaaaaaaaaaaaa"
@@ -4268,24 +4279,31 @@ CompScreen::init (const char *name)
XWindowEvent (dpy, currentWmSnOwner, StructureNotifyMask, &event);
} while (event.type != DestroyNotify);
}
+
+select_input:
CompScreen::checkForError (dpy);
XGrabServer (dpy);
-
- XSelectInput (dpy, root,
- SubstructureRedirectMask |
- SubstructureNotifyMask |
+
+ inputMask = SubstructureNotifyMask |
StructureNotifyMask |
PropertyChangeMask |
LeaveWindowMask |
EnterWindowMask |
- KeyPressMask |
- KeyReleaseMask |
- ButtonPressMask |
- ButtonReleaseMask |
FocusChangeMask |
- ExposureMask);
+ ExposureMask;
+
+ if (!zcomp)
+ {
+ inputMask |= SubstructureRedirectMask;
+ inputMask |= KeyPressMask;
+ inputMask |= KeyReleaseMask;
+ inputMask |= ButtonPressMask;
+ inputMask |= ButtonReleaseMask;
+ }
+
+ XSelectInput (dpy, root, inputMask);
if (CompScreen::checkForError (dpy))
{
diff --git a/src/window.cpp b/src/window.cpp
index c43b3c5..9913d9e 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -885,8 +885,8 @@ PrivateWindow::updateRegion ()
{
r.x = -priv->attrib.border_width;
r.y = -priv->attrib.border_width;
- r.width = priv->width + priv->attrib.border_width;
- r.height = priv->height + priv->attrib.border_width;
+ r.width = priv->width + priv->attrib.border_width * 2;
+ r.height = priv->height + priv->attrib.border_width * 2;
rects = &r;
n = 1;
@@ -900,8 +900,8 @@ PrivateWindow::updateRegion ()
{
x1 = rects[i].x + priv->attrib.border_width;
y1 = rects[i].y + priv->attrib.border_width;
- x2 = x1 + rects[i].width;
- y2 = y1 + rects[i].height;
+ x2 = x1 + rects[i].width + priv->attrib.border_width;
+ y2 = y1 + rects[i].height + priv->attrib.border_width;
if (x1 < 0)
x1 = 0;
@@ -1193,10 +1193,14 @@ CompWindow::destroy ()
}
+
void
CompWindow::sendConfigureNotify ()
{
XConfigureEvent xev;
+
+ if (zcomp)
+ return;
xev.type = ConfigureNotify;
xev.event = priv->id;
@@ -1268,11 +1272,13 @@ CompWindow::map ()
priv->unmapRefCnt = 1;
priv->attrib.map_state = IsViewable;
+
+ compLogMessage ("zcomp", CompLogLevelWarn, "map %i :: %x", priv->mapNum, id()); // TTX
if (!overrideRedirect ())
screen->priv->setWmState (NormalState, priv->id);
- priv->invisible = true;
+ priv->invisible = zcomp ? false : true;
priv->alive = true;
priv->lastPong = screen->priv->lastPing;
@@ -4952,9 +4958,10 @@ CompWindow::CompWindow (Window id,
priv->id = id;
- XGrabButton (screen->dpy (), AnyButton, AnyModifier, priv->id, true,
- ButtonPressMask | ButtonReleaseMask | ButtonMotionMask,
- GrabModeSync, GrabModeSync, None, None);
+ if (!zcomp)
+ XGrabButton (screen->dpy (), AnyButton, AnyModifier, priv->id, true,
+ ButtonPressMask | ButtonReleaseMask | ButtonMotionMask,
+ GrabModeSync, GrabModeSync, None, None);
priv->alpha = (depth () == 32);
priv->lastPong = screen->priv->lastPing;
@@ -5450,6 +5457,9 @@ PrivateWindow::reparent ()
XEvent e;
CompWindow::Geometry sg = serverGeometry;
Display *dpy = screen->dpy ();
+
+ if (zcomp)
+ return true;
if (frame || attrib.override_redirect)
return false;
@@ -5544,6 +5554,9 @@ PrivateWindow::unreparent ()
XEvent e;
bool alive = true;
XWindowChanges xwc;
+
+ if (zcomp)
+ return;
if (!frame)
return;
diff --git a/src/windowgeometry.cpp b/src/windowgeometry.cpp
index 1bbefd6..3b8ac76 100644
--- a/src/windowgeometry.cpp
+++ b/src/windowgeometry.cpp
@@ -166,9 +166,9 @@ CompWindow::inputRect () const
{
return CompRect (priv->geometry.x () - priv->input.left,
priv->geometry.y () - priv->input.top,
- priv->geometry.width () +
+ priv->width + //priv->geometry.width () +
priv->input.left + priv->input.right,
- priv->geometry.height () +
+ priv->height + //priv->geometry.height () +
priv->input.top + priv->input.bottom);
}