diff options
author | Dennis Kasprzyk <onestone@compiz-fusion.org> | 2008-09-17 16:21:38 +0200 |
---|---|---|
committer | Dennis Kasprzyk <onestone@compiz-fusion.org> | 2008-09-17 16:21:38 +0200 |
commit | 4be312889b0b9c90a293566be5357a06900581b7 (patch) | |
tree | 4e8439683fb89e1c0f490a1d72d6a9643372adc6 /src | |
parent | c9b41c3d2571896371b4a7179a487a2e8b971c85 (diff) | |
download | unity-window-decorator-4be312889b0b9c90a293566be5357a06900581b7.tar.gz unity-window-decorator-4be312889b0b9c90a293566be5357a06900581b7.tar.bz2 |
Cleanup CompScreen public API and move header to core/screen.h
Diffstat (limited to 'src')
-rw-r--r-- | src/action.cpp | 5 | ||||
-rw-r--r-- | src/actions.cpp | 2 | ||||
-rw-r--r-- | src/event.cpp | 67 | ||||
-rw-r--r-- | src/match.cpp | 5 | ||||
-rw-r--r-- | src/metadata.cpp | 3 | ||||
-rw-r--r-- | src/privateoption.h | 2 | ||||
-rw-r--r-- | src/privatescreen.h | 95 | ||||
-rw-r--r-- | src/privatewindow.h | 1 | ||||
-rw-r--r-- | src/screen.cpp | 217 | ||||
-rw-r--r-- | src/timer.cpp | 2 | ||||
-rw-r--r-- | src/window.cpp | 58 |
11 files changed, 243 insertions, 214 deletions
diff --git a/src/action.cpp b/src/action.cpp index 2415c38..2169da3 100644 --- a/src/action.cpp +++ b/src/action.cpp @@ -31,8 +31,9 @@ #include <compoption.h> #include <compaction.h> -#include <compscreen.h> -#include <privateaction.h> +#include <core/screen.h> +#include "privateaction.h" +#include "privatescreen.h" struct _Modifier { const char *name; diff --git a/src/actions.cpp b/src/actions.cpp index c4d12e9..1385012 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -1,4 +1,4 @@ -#include <compscreen.h> +#include <core/screen.h> #include <compwindow.h> #include <core/atoms.h> #include "privatescreen.h" diff --git a/src/event.cpp b/src/event.cpp index 1796c25..418351c 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -181,7 +181,7 @@ PrivateScreen::triggerButtonPressBindings (CompOption::Vector &options, { if (action->button ().button () == (int) event->xbutton.button) { - bindMods = screen->virtualToRealModMask ( + bindMods = virtualToRealModMask ( action->button ().modifiers ()); if ((bindMods & modMask) == (event->xbutton.state & modMask)) @@ -199,7 +199,7 @@ PrivateScreen::triggerButtonPressBindings (CompOption::Vector &options, (int) event->xbutton.button) && (action->edgeMask () & edge)) { - bindMods = screen->virtualToRealModMask ( + bindMods = virtualToRealModMask ( action->button ().modifiers ()); if ((bindMods & modMask) == @@ -278,7 +278,7 @@ PrivateScreen::triggerKeyPressBindings (CompOption::Vector &options, if (isInitiateBinding (option, CompAction::BindingTypeKey, state, &action)) { - bindMods = screen->virtualToRealModMask ( + bindMods = virtualToRealModMask ( action->key ().modifiers ()); if (action->key ().keycode () == (int) event->xkey.keycode) @@ -312,7 +312,7 @@ PrivateScreen::triggerKeyReleaseBindings (CompOption::Vector &options, unsigned int bindMods; unsigned int mods; - mods = screen->keycodeToModifiers (event->xkey.keycode); + mods = keycodeToModifiers (event->xkey.keycode); if (mods == 0) return false; @@ -321,8 +321,7 @@ PrivateScreen::triggerKeyReleaseBindings (CompOption::Vector &options, if (isTerminateBinding (option, CompAction::BindingTypeKey, state, &action)) { - bindMods = - screen->virtualToRealModMask (action->key ().modifiers ()); + bindMods = virtualToRealModMask (action->key ().modifiers ()); if ((mods & modMask & bindMods) != bindMods) { @@ -357,8 +356,8 @@ PrivateScreen::triggerStateNotifyBindings (CompOption::Vector &options, { if (action->key ().keycode () == 0) { - bindMods = screen->virtualToRealModMask ( - action->key ().modifiers ()); + bindMods = + virtualToRealModMask (action->key ().modifiers ()); if ((event->mods & modMask & bindMods) == bindMods) { @@ -378,8 +377,7 @@ PrivateScreen::triggerStateNotifyBindings (CompOption::Vector &options, if (isTerminateBinding (option, CompAction::BindingTypeKey, state, &action)) { - bindMods = - screen->virtualToRealModMask (action->key ().modifiers ()); + bindMods = virtualToRealModMask (action->key ().modifiers ()); if ((event->mods & modMask & bindMods) != bindMods) { @@ -942,18 +940,20 @@ CompScreen::handleEvent (XEvent *event) switch (event->type) { case ButtonPress: if (event->xbutton.root == priv->root) - setCurrentOutput (outputDeviceForPoint (event->xbutton.x_root, - event->xbutton.y_root)); + priv->setCurrentOutput ( + outputDeviceForPoint (event->xbutton.x_root, + event->xbutton.y_root)); break; case MotionNotify: if (event->xmotion.root == priv->root) - setCurrentOutput (outputDeviceForPoint (event->xmotion.x_root, - event->xmotion.y_root)); + priv->setCurrentOutput ( + outputDeviceForPoint (event->xmotion.x_root, + event->xmotion.y_root)); break; case KeyPress: w = findWindow (priv->activeWindow); if (w) - setCurrentOutput (w->outputDevice ()); + priv->setCurrentOutput (w->outputDevice ()); default: break; } @@ -990,7 +990,7 @@ CompScreen::handleEvent (XEvent *event) else { if (event->xconfigure.window == priv->root) - configure (&event->xconfigure); + priv->configure (&event->xconfigure); } } break; @@ -1001,7 +1001,7 @@ CompScreen::handleEvent (XEvent *event) (!w || w->frame () != event->xcreatewindow.window)) { new CompWindow (screen, event->xcreatewindow.window, - getTopWindow ()); + priv->getTopWindow ()); } break; case DestroyNotify: @@ -1036,7 +1036,7 @@ CompScreen::handleEvent (XEvent *event) /* Normal -> Iconic */ if (w->pendingUnmaps ()) { - setWmState (IconicState, w->id ()); + priv->setWmState (IconicState, w->id ()); w->pendingUnmaps ()--; } else /* X -> Withdrawn */ @@ -1048,11 +1048,11 @@ CompScreen::handleEvent (XEvent *event) w->changeState (w->state () & ~CompWindowStateHiddenMask); - w->screen () ->updateClientList (); + priv->updateClientList (); } if (!w->overrideRedirect ()) - setWmState (WithdrawnState, w->id ()); + priv->setWmState (WithdrawnState, w->id ()); w->placed () = false; w->managed () = false; @@ -1068,7 +1068,8 @@ CompScreen::handleEvent (XEvent *event) w = findWindow (event->xreparent.window); if (!w) { - new CompWindow (this, event->xreparent.window, getTopWindow ()); + new CompWindow (this, event->xreparent.window, + priv->getTopWindow ()); } else if (w && !(event->xreparent.parent == w->wrapper () || event->xreparent.parent == priv->root)) @@ -1122,16 +1123,16 @@ CompScreen::handleEvent (XEvent *event) { unsigned int type; - type = getWindowType (w->id ()); + type = priv->getWindowType (w->id ()); if (type != w->wmType ()) { if (w->isViewable ()) { if (w->type () == CompWindowTypeDesktopMask) - w->screen ()->desktopWindowCount ()--; + priv->desktopWindowCount--; else if (type == CompWindowTypeDesktopMask) - w->screen ()->desktopWindowCount ()++; + priv->desktopWindowCount++; } w->wmType () = type; @@ -1143,7 +1144,7 @@ CompScreen::handleEvent (XEvent *event) CompWindowTypeDesktopMask)) w->setDesktop (0xffffffff); - w->screen ()->updateClientList (); + priv->updateClientList (); matchPropertyChanged (w); } @@ -1156,7 +1157,7 @@ CompScreen::handleEvent (XEvent *event) { unsigned int state; - state = getWindowState (w->id ()); + state = priv->getWindowState (w->id ()); state = CompWindow::constrainWindowState (state, w->actions ()); if (state != w->state ()) @@ -1213,7 +1214,7 @@ CompScreen::handleEvent (XEvent *event) if (w) { if (w->updateStruts ()) - w->screen ()->updateWorkarea (); + priv->updateWorkarea (); } } else if (event->xproperty.atom == Atoms::mwmHints) @@ -1226,7 +1227,7 @@ CompScreen::handleEvent (XEvent *event) { w = findWindow (event->xproperty.window); if (w) - w->protocols () = getProtocols (w->id ()); + w->priv->protocols = priv->getProtocols (w->id ()); } else if (event->xproperty.atom == Atoms::wmIcon) { @@ -1276,7 +1277,7 @@ CompScreen::handleEvent (XEvent *event) for (i = 1; i < 3; i++) { - state = windowStateMask (event->xclient.data.l[i]); + state = priv->windowStateMask (event->xclient.data.l[i]); if (state & ~CompWindowStateHiddenMask) { @@ -1464,7 +1465,7 @@ CompScreen::handleEvent (XEvent *event) else if (event->xclient.message_type == Atoms::currentDesktop) { if (event->xclient.window == priv->root) - setCurrentDesktop (event->xclient.data.l[0]); + priv->setCurrentDesktop (event->xclient.data.l[0]); } else if (event->xclient.message_type == Atoms::winDesktop) { @@ -1474,7 +1475,7 @@ CompScreen::handleEvent (XEvent *event) } break; case MappingNotify: - updateModifierMappings (); + priv->updateModifierMappings (); break; case MapRequest: w = findWindow (event->xmaprequest.window); @@ -1594,9 +1595,9 @@ CompScreen::handleEvent (XEvent *event) if (w->id () != priv->activeWindow) { priv->activeWindow = w->id (); - w->activeNum () = w->screen ()->activeNum ()++; + w->priv->activeNum = priv->activeNum++; - w->screen ()->addToCurrentActiveWindowHistory (w->id ()); + priv->addToCurrentActiveWindowHistory (w->id ()); XChangeProperty (priv->dpy , w->screen ()->root (), Atoms::winActive, diff --git a/src/match.cpp b/src/match.cpp index 49c8df5..228d8bf 100644 --- a/src/match.cpp +++ b/src/match.cpp @@ -31,11 +31,12 @@ #include <compiz-core.h> -#include <compscreen.h> +#include <core/screen.h> #include <compmatch.h> #include <compwindow.h> #include <compplugin.h> #include "privatematch.h" +#include "privatescreen.h" class CoreExp : public CompMatch::Expression { public: @@ -58,7 +59,7 @@ class CoreExp : public CompMatch::Expression { else if (str.compare (0, 6, "state=") == 0) { mType = TypeState; - priv.uval = CompScreen::windowStateFromString + priv.uval = PrivateScreen::windowStateFromString (str.substr (6).c_str ()); } else if (str.compare (0, 18, "override_redirect=") == 0) diff --git a/src/metadata.cpp b/src/metadata.cpp index c805c26..ea91d40 100644 --- a/src/metadata.cpp +++ b/src/metadata.cpp @@ -35,7 +35,8 @@ #include <compiz.h> #include <compmetadata.h> -#include <compscreen.h> +#include <core/screen.h> +#include "privatescreen.h" #define HOME_METADATADIR ".compiz/metadata" #define EXTENSION ".xml" diff --git a/src/privateoption.h b/src/privateoption.h index c723163..f8ef51c 100644 --- a/src/privateoption.h +++ b/src/privateoption.h @@ -5,7 +5,7 @@ #include <compaction.h> #include <compmatch.h> -#include <compscreen.h> +#include <core/screen.h> typedef struct _CompOptionIntRestriction { int min; diff --git a/src/privatescreen.h b/src/privatescreen.h index 9ba403b..970c67a 100644 --- a/src/privatescreen.h +++ b/src/privatescreen.h @@ -2,7 +2,7 @@ #define _PRIVATESCREEN_H #include <compiz-core.h> -#include <compscreen.h> +#include <core/screen.h> #include <compsize.h> #include <comppoint.h> #include <core/timer.h> @@ -130,6 +130,32 @@ typedef struct _CompDelayedEdgeSettings #define FOCUS_PREVENTION_LEVEL_VERYHIGH 3 #define FOCUS_PREVENTION_LEVEL_LAST FOCUS_PREVENTION_LEVEL_VERYHIGH +#define SCREEN_EDGE_LEFT 0 +#define SCREEN_EDGE_RIGHT 1 +#define SCREEN_EDGE_TOP 2 +#define SCREEN_EDGE_BOTTOM 3 +#define SCREEN_EDGE_TOPLEFT 4 +#define SCREEN_EDGE_TOPRIGHT 5 +#define SCREEN_EDGE_BOTTOMLEFT 6 +#define SCREEN_EDGE_BOTTOMRIGHT 7 +#define SCREEN_EDGE_NUM 8 + +struct CompScreenEdge { + Window id; + unsigned int count; +}; + +struct CompGroup { + unsigned int refCnt; + Window id; +}; + +struct CompStartupSequence { + SnStartupSequence *sequence; + unsigned int viewportX; + unsigned int viewportY; +}; + extern const CompMetadata::OptionInfo coreOptionInfo[COMP_OPTION_NUM]; @@ -305,9 +331,76 @@ class PrivateScreen { void updateScreenInfo (); + void updateModifierMappings (); + + unsigned int virtualToRealModMask (unsigned int modMask); + + unsigned int keycodeToModifiers (int keycode); + + Window getActiveWindow (Window root); + + int getWmState (Window id); + + void setWmState (int state, Window id); + + unsigned int windowStateMask (Atom state); + + static unsigned int windowStateFromString (const char *str); + + unsigned int getWindowState (Window id); + + void setWindowState (unsigned int state, Window id); + + unsigned int getWindowType (Window id); + + void getMwmHints (Window id, + unsigned int *func, + unsigned int *decor); + + unsigned int getProtocols (Window id); + + bool readWindowProp32 (Window id, + Atom property, + unsigned short *returnValue); + + void setCurrentOutput (unsigned int outputNum); + + + void configure (XConfigureEvent *ce); + + void eraseWindowFromMap (Window id); + + void updateWorkarea (); + + void updateClientList (); + + CompGroup * addGroup (Window id); + + void removeGroup (CompGroup *group); + + CompGroup * findGroup (Window id); + + void applyStartupProperties (CompWindow *window); + + Window getTopWindow (); + + void setNumberOfDesktops (unsigned int nDesktop); + + void setCurrentDesktop (unsigned int desktop); + + bool updateDefaultIcon (); + + void setCurrentActiveWindowHistory (int x, int y); + + void addToCurrentActiveWindowHistory (Window id); + + void enableEdge (int edge); + + void disableEdge (int edge); public: + PrivateScreen *priv; std::list<CompFileWatch *> fileWatch; CompFileWatchHandle lastFileWatchHandle; diff --git a/src/privatewindow.h b/src/privatewindow.h index 0251746..ff31be7 100644 --- a/src/privatewindow.h +++ b/src/privatewindow.h @@ -5,6 +5,7 @@ #include <compwindow.h> #include <comppoint.h> #include <core/timer.h> +#include "privatescreen.h" #define WINDOW_INVISIBLE(w) \ ((w)->attrib.map_state != IsViewable || \ diff --git a/src/screen.cpp b/src/screen.cpp index 63a9faa..5ad084c 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -55,7 +55,7 @@ #include <compiz-core.h> -#include <compscreen.h> +#include <core/screen.h> #include <compicon.h> #include <core/atoms.h> #include "privatescreen.h" @@ -701,19 +701,12 @@ CompScreen::autoRaiseWindow () return priv->autoRaiseWindow; } - const char * CompScreen::displayString () { return priv->displayString; } -unsigned int -CompScreen::lastPing () -{ - return priv->lastPing; -} - void PrivateScreen::updateScreenInfo () { @@ -859,13 +852,13 @@ CompScreen::setOption (const char *name, case COMP_OPTION_NUMBER_OF_DESKTOPS: if (o->set (value)) { - setNumberOfDesktops (o->value ().i ()); + priv->setNumberOfDesktops (o->value ().i ()); return true; } break; case COMP_OPTION_DEFAULT_ICON: if (o->set (value)) - return updateDefaultIcon (); + return priv->updateDefaultIcon (); break; case COMP_OPTION_OUTPUTS: if (!noDetection && @@ -888,7 +881,7 @@ CompScreen::setOption (const char *name, } void -CompScreen::updateModifierMappings () +PrivateScreen::updateModifierMappings () { unsigned int modMask[CompModNum]; int i, minKeycode, maxKeycode, keysymsPerKeycode = 0; @@ -897,38 +890,38 @@ CompScreen::updateModifierMappings () for (i = 0; i < CompModNum; i++) modMask[i] = 0; - XDisplayKeycodes (priv->dpy, &minKeycode, &maxKeycode); - key = XGetKeyboardMapping (priv->dpy, + XDisplayKeycodes (this->dpy, &minKeycode, &maxKeycode); + key = XGetKeyboardMapping (this->dpy, minKeycode, (maxKeycode - minKeycode + 1), &keysymsPerKeycode); - if (priv->modMap) - XFreeModifiermap (priv->modMap); + if (this->modMap) + XFreeModifiermap (this->modMap); - priv->modMap = XGetModifierMapping (priv->dpy); - if (priv->modMap && priv->modMap->max_keypermod > 0) + this->modMap = XGetModifierMapping (this->dpy); + if (this->modMap && this->modMap->max_keypermod > 0) { KeySym keysym; int index, size, mask; - size = maskTableSize * priv->modMap->max_keypermod; + size = maskTableSize * this->modMap->max_keypermod; for (i = 0; i < size; i++) { - if (!priv->modMap->modifiermap[i]) + if (!this->modMap->modifiermap[i]) continue; index = 0; do { - keysym = XKeycodeToKeysym (priv->dpy, - priv->modMap->modifiermap[i], + keysym = XKeycodeToKeysym (this->dpy, + this->modMap->modifiermap[i], index++); } while (!keysym && index < keysymsPerKeycode); if (keysym) { - mask = maskTable[i / priv->modMap->max_keypermod]; + mask = maskTable[i / this->modMap->max_keypermod]; if (keysym == XK_Alt_L || keysym == XK_Alt_R) @@ -971,15 +964,15 @@ CompScreen::updateModifierMappings () modMask[i] = CompNoMask; } - if (memcmp (modMask, priv->modMask, sizeof (modMask))) + if (memcmp (modMask, this->modMask, sizeof (modMask))) { - memcpy (priv->modMask, modMask, sizeof (modMask)); + memcpy (this->modMask, modMask, sizeof (modMask)); - priv->ignoredModMask = LockMask | + this->ignoredModMask = LockMask | (modMask[CompModNumLock] & ~CompNoMask) | (modMask[CompModScrollLock] & ~CompNoMask); - priv->updatePassiveKeyGrabs (); + this->updatePassiveKeyGrabs (); } } @@ -988,7 +981,7 @@ CompScreen::updateModifierMappings () } unsigned int -CompScreen::virtualToRealModMask (unsigned int modMask) +PrivateScreen::virtualToRealModMask (unsigned int modMask) { int i; @@ -997,7 +990,7 @@ CompScreen::virtualToRealModMask (unsigned int modMask) if (modMask & virtualModMask[i]) { modMask &= ~virtualModMask[i]; - modMask |= priv->modMask[i]; + modMask |= this->modMask[i]; } } @@ -1005,17 +998,17 @@ CompScreen::virtualToRealModMask (unsigned int modMask) } unsigned int -CompScreen::keycodeToModifiers (int keycode) +PrivateScreen::keycodeToModifiers (int keycode) { unsigned int mods = 0; int mod, k; for (mod = 0; mod < maskTableSize; mod++) { - for (k = 0; k < priv->modMap->max_keypermod; k++) + for (k = 0; k < modMap->max_keypermod; k++) { - if (priv->modMap->modifiermap[mod * - priv->modMap->max_keypermod + k] == keycode) + if (modMap->modifiermap[mod * + modMap->max_keypermod + k] == keycode) mods |= maskTable[mod]; } } @@ -1341,7 +1334,7 @@ CompScreen::writeImageToFile (const char *path, } Window -CompScreen::getActiveWindow (Window root) +PrivateScreen::getActiveWindow (Window root) { Atom actual; int result, format; @@ -1453,7 +1446,7 @@ compLogMessage (const char *componentName, } int -CompScreen::getWmState (Window id) +PrivateScreen::getWmState (Window id) { Atom actual; int result, format; @@ -1476,7 +1469,7 @@ CompScreen::getWmState (Window id) } void -CompScreen::setWmState (int state, Window id) +PrivateScreen::setWmState (int state, Window id) { unsigned long data[2]; @@ -1489,7 +1482,7 @@ CompScreen::setWmState (int state, Window id) } unsigned int -CompScreen::windowStateMask (Atom state) +PrivateScreen::windowStateMask (Atom state) { if (state == Atoms::winStateModal) return CompWindowStateModalMask; @@ -1522,7 +1515,7 @@ CompScreen::windowStateMask (Atom state) } unsigned int -CompScreen::windowStateFromString (const char *str) +PrivateScreen::windowStateFromString (const char *str) { if (strcasecmp (str, "modal") == 0) return CompWindowStateModalMask; @@ -1553,7 +1546,7 @@ CompScreen::windowStateFromString (const char *str) } unsigned int -CompScreen::getWindowState (Window id) +PrivateScreen::getWindowState (Window id) { Atom actual; int result, format; @@ -1580,8 +1573,7 @@ CompScreen::getWindowState (Window id) } void -CompScreen::setWindowState (unsigned int state, - Window id) +PrivateScreen::setWindowState (unsigned int state, Window id) { Atom data[32]; int i = 0; @@ -1619,7 +1611,7 @@ CompScreen::setWindowState (unsigned int state, } unsigned int -CompScreen::getWindowType (Window id) +PrivateScreen::getWindowType (Window id) { Atom actual; int result, format; @@ -1672,9 +1664,9 @@ CompScreen::getWindowType (Window id) } void -CompScreen::getMwmHints (Window id, - unsigned int *func, - unsigned int *decor) +PrivateScreen::getMwmHints (Window id, + unsigned int *func, + unsigned int *decor) { Atom actual; int result, format; @@ -1707,7 +1699,7 @@ CompScreen::getMwmHints (Window id, } unsigned int -CompScreen::getProtocols (Window id) +PrivateScreen::getProtocols (Window id) { Atom *protocol; int count; @@ -1776,9 +1768,9 @@ CompScreen::setWindowProp (Window id, } bool -CompScreen::readWindowProp32 (Window id, - Atom property, - unsigned short *returnValue) +PrivateScreen::readWindowProp32 (Window id, + Atom property, + unsigned short *returnValue) { Atom actual; int result, format; @@ -1812,7 +1804,7 @@ CompScreen::getWindowProp32 (Window id, { unsigned short result; - if (readWindowProp32 (id, property, &result)) + if (priv->readWindowProp32 (id, property, &result)) return result; return defaultValue; @@ -2057,9 +2049,9 @@ PrivateScreen::updateOutputDevices () hasOverlappingOutputs = false; - screen->setCurrentOutput (currentOutputDev); + setCurrentOutput (currentOutputDev); - screen->updateWorkarea (); + updateWorkarea (); screen->outputChangeNotify (); } @@ -2249,7 +2241,7 @@ PrivateScreen::updateScreenEdges () void -CompScreen::setCurrentOutput (unsigned int outputNum) +PrivateScreen::setCurrentOutput (unsigned int outputNum) { if (outputNum >= priv->outputDevs.size ()) outputNum = 0; @@ -2280,7 +2272,7 @@ PrivateScreen::reshape (int w, int h) } void -CompScreen::configure (XConfigureEvent *ce) +PrivateScreen::configure (XConfigureEvent *ce) { if (priv->attrib.width != ce->width || priv->attrib.height != ce->height) @@ -2599,18 +2591,6 @@ CompScreen::leaveShowDesktopMode (CompWindow *window) (unsigned char *) &data, 1); } -CompString -CompScreen::objectName () -{ - char tmp[256]; - - snprintf (tmp, 256, "%d", priv->screenNum); - - return CompString (tmp); - -} - - void CompScreen::forEachWindow (CompWindow::ForEach proc) { @@ -2772,7 +2752,7 @@ CompScreen::insertWindow (CompWindow *w, Window aboveId) } void -CompScreen::eraseWindowFromMap (Window id) +PrivateScreen::eraseWindowFromMap (Window id) { if (id != 1) priv->windowsMap.erase (id); @@ -2785,7 +2765,7 @@ CompScreen::unhookWindow (CompWindow *w) std::find (priv->windows.begin (), priv->windows.end (), w); priv->windows.erase (it); - eraseWindowFromMap (w->id ()); + priv->eraseWindowFromMap (w->id ()); if (w->next) w->next->prev = w->prev; @@ -3005,7 +2985,7 @@ PrivateScreen::addPassiveKeyGrab (CompAction::KeyBinding &key) unsigned int mask; std::list<KeyGrab>::iterator it; - mask = screen->virtualToRealModMask (key.modifiers ()); + mask = virtualToRealModMask (key.modifiers ()); for (it = keyGrabs.begin (); it != keyGrabs.end (); it++) { @@ -3040,7 +3020,7 @@ PrivateScreen::removePassiveKeyGrab (CompAction::KeyBinding &key) unsigned int mask; std::list<KeyGrab>::iterator it; - mask = screen->virtualToRealModMask (key.modifiers ()); + mask = virtualToRealModMask (key.modifiers ()); for (it = keyGrabs.begin (); it != keyGrabs.end (); it++) { @@ -3146,7 +3126,7 @@ CompScreen::addAction (CompAction *action) for (i = 0; i < SCREEN_EDGE_NUM; i++) if (action->edgeMask () & (1 << i)) - enableEdge (i); + priv->enableEdge (i); } return true; @@ -3167,7 +3147,7 @@ CompScreen::removeAction (CompAction *action) for (i = 0; i < SCREEN_EDGE_NUM; i++) if (action->edgeMask () & (1 << i)) - disableEdge (i); + priv->disableEdge (i); } } @@ -3272,7 +3252,7 @@ PrivateScreen::computeWorkareaForBox (BoxPtr pBox, } void -CompScreen::updateWorkarea () +PrivateScreen::updateWorkarea () { XRectangle workArea; BoxRec box; @@ -3356,7 +3336,7 @@ compareMappingOrder (const void *w1, } void -CompScreen::updateClientList () +PrivateScreen::updateClientList () { Window *clientList; Window *clientListStacking; @@ -3364,7 +3344,7 @@ CompScreen::updateClientList () Bool updateClientListStacking = true; int i, n = 0; - forEachWindow (boost::bind (countClientListWindow, _1, &n)); + screen->forEachWindow (boost::bind (countClientListWindow, _1, &n)); if (n == 0) { @@ -3564,7 +3544,7 @@ CompScreen::moveViewport (int tx, int ty, bool sync) priv->setDesktopHints (); - setCurrentActiveWindowHistory (priv->vp.x (), priv->vp.y ()); + priv->setCurrentActiveWindowHistory (priv->vp.x (), priv->vp.y ()); w = findWindow (priv->activeWindow); if (w) @@ -3576,13 +3556,13 @@ CompScreen::moveViewport (int tx, int ty, bool sync) /* add window to current history if it's default viewport is still the current one. */ if (priv->vp.x () == x && priv->vp.y () == y) - addToCurrentActiveWindowHistory (w->id ()); + priv->addToCurrentActiveWindowHistory (w->id ()); } } } CompGroup * -CompScreen::addGroup (Window id) +PrivateScreen::addGroup (Window id) { CompGroup *group = new CompGroup (); @@ -3595,7 +3575,7 @@ CompScreen::addGroup (Window id) } void -CompScreen::removeGroup (CompGroup *group) +PrivateScreen::removeGroup (CompGroup *group) { group->refCnt--; if (group->refCnt) @@ -3613,7 +3593,7 @@ CompScreen::removeGroup (CompGroup *group) } CompGroup * -CompScreen::findGroup (Window id) +PrivateScreen::findGroup (Window id) { foreach (CompGroup *g, priv->groups) if (g->id == id) @@ -3623,7 +3603,7 @@ CompScreen::findGroup (Window id) } void -CompScreen::applyStartupProperties (CompWindow *window) +PrivateScreen::applyStartupProperties (CompWindow *window) { CompStartupSequence *s = NULL; const char *startupId = window->startupId (); @@ -3632,7 +3612,7 @@ CompScreen::applyStartupProperties (CompWindow *window) { CompWindow *leader; - leader = findWindow (window->clientLeader ()); + leader = screen->findWindow (window->clientLeader ()); if (leader) startupId = leader->startupId (); @@ -3680,7 +3660,7 @@ CompScreen::sendWindowActivationRequest (Window id) void -CompScreen::enableEdge (int edge) +PrivateScreen::enableEdge (int edge) { priv->screenEdge[edge].count++; if (priv->screenEdge[edge].count == 1) @@ -3688,7 +3668,7 @@ CompScreen::enableEdge (int edge) } void -CompScreen::disableEdge (int edge) +PrivateScreen::disableEdge (int edge) { priv->screenEdge[edge].count--; if (priv->screenEdge[edge].count == 0) @@ -3696,7 +3676,7 @@ CompScreen::disableEdge (int edge) } Window -CompScreen::getTopWindow () +PrivateScreen::getTopWindow () { /* return first window that has not been destroyed */ for (CompWindowList::reverse_iterator rit = priv->windows.rbegin (); @@ -3709,10 +3689,6 @@ CompScreen::getTopWindow () return None; } - - - - int CompScreen::outputDeviceForPoint (int x, int y) { @@ -3736,7 +3712,7 @@ CompScreen::getCurrentOutputExtents (int *x1, int *y1, int *x2, int *y2) } void -CompScreen::setNumberOfDesktops (unsigned int nDesktop) +PrivateScreen::setNumberOfDesktops (unsigned int nDesktop) { if (nDesktop < 1 || nDesktop >= 0xffffffff) return; @@ -3762,7 +3738,7 @@ CompScreen::setNumberOfDesktops (unsigned int nDesktop) } void -CompScreen::setCurrentDesktop (unsigned int desktop) +PrivateScreen::setCurrentDesktop (unsigned int desktop) { unsigned long data; @@ -3982,7 +3958,7 @@ CompScreen::outputDeviceForGeometry (CompWindow::Geometry gm) } bool -CompScreen::updateDefaultIcon () +PrivateScreen::updateDefaultIcon () { CompString file = priv->opt[COMP_OPTION_DEFAULT_ICON].value ().s (); void *data; @@ -3994,10 +3970,10 @@ CompScreen::updateDefaultIcon () priv->defaultIcon = NULL; } - if (!readImageFromFile (file.c_str (), &width, &height, &data)) + if (!screen->readImageFromFile (file.c_str (), &width, &height, &data)) return false; - priv->defaultIcon = new CompIcon (this, width, height); + priv->defaultIcon = new CompIcon (screen, width, height); memcpy (priv->defaultIcon->data (), data, width * height * sizeof (CARD32)); @@ -4007,7 +3983,7 @@ CompScreen::updateDefaultIcon () } void -CompScreen::setCurrentActiveWindowHistory (int x, int y) +PrivateScreen::setCurrentActiveWindowHistory (int x, int y) { int i, min = 0; @@ -4034,7 +4010,7 @@ CompScreen::setCurrentActiveWindowHistory (int x, int y) } void -CompScreen::addToCurrentActiveWindowHistory (Window id) +PrivateScreen::addToCurrentActiveWindowHistory (Window id) { CompActiveWindowHistory *history = &priv->history[priv->currentHistory]; Window tmp, next = id; @@ -4074,16 +4050,6 @@ CompScreen::root () return priv->root; } -unsigned int -CompScreen::showingDesktopMask () -{ - return priv->showingDesktopMask; -} - - - - - void CompScreen::warpPointer (int dx, int dy) { @@ -4143,24 +4109,12 @@ CompScreen::getCurrentTime () return event.xproperty.time; } -Atom -CompScreen::selectionAtom () -{ - return priv->wmSnAtom; -} - Window CompScreen::selectionWindow () { return priv->wmSnSelectionWindow; } -Time -CompScreen::selectionTimestamp () -{ - return priv->wmSnTimestamp; -} - int CompScreen::screenNum () { @@ -4185,13 +4139,7 @@ CompScreen::size () return priv->size; } -unsigned int & -CompScreen::mapNum () -{ - return priv->mapNum; -} - -int & +int CompScreen::desktopWindowCount () { return priv->desktopWindowCount; @@ -4228,24 +4176,6 @@ CompScreen::currentHistory () return &priv->history[priv->currentHistory]; } -CompScreenEdge & -CompScreen::screenEdge (int edge) -{ - return priv->screenEdge[edge]; -} - -unsigned int & -CompScreen::activeNum () -{ - return priv->activeNum; -} - -unsigned int & -CompScreen::pendingDestroys () -{ - return priv->pendingDestroys; -} - void PrivateScreen::removeDestroyed () { @@ -4377,7 +4307,7 @@ CompScreen::init (const char *name) XSetErrorHandler (errorHandler); - updateModifierMappings (); + priv->updateModifierMappings (); priv->snDisplay = sn_display_new (dpy, NULL, NULL); if (!priv->snDisplay) @@ -4768,6 +4698,7 @@ CompScreen::~CompScreen () } PrivateScreen::PrivateScreen (CompScreen *screen) : + priv (this), fileWatch (0), lastFileWatchHandle (1), timers (0), diff --git a/src/timer.cpp b/src/timer.cpp index 2045220..5aa4065 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -1,5 +1,5 @@ #include <core/timer.h> -#include <compscreen.h> +#include <core/screen.h> #include "privatescreen.h" CompTimer::CompTimer () : diff --git a/src/window.cpp b/src/window.cpp index 9dee337..da40b0c 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -420,7 +420,7 @@ CompWindow::changeState (unsigned int newState) recalcType (); recalcActions (); - priv->screen->setWindowState (priv->state, priv->id); + priv->screen->priv->setWindowState (priv->state, priv->id); stateChangeNotify (oldState); priv->screen->matchPropertyChanged (this); @@ -1060,7 +1060,7 @@ setDefaultWindowAttributes (XWindowAttributes *wa) void CompWindow::destroy () { - screen ()->eraseWindowFromMap (id ()); + screen ()->priv->eraseWindowFromMap (id ()); priv->id = 1; priv->mapNum = 0; @@ -1075,7 +1075,7 @@ CompWindow::destroy () if (!priv->destroyed) { priv->destroyed = true; - priv->screen->pendingDestroys ()++; + priv->screen->priv->pendingDestroys++; } } @@ -1140,10 +1140,10 @@ CompWindow::map () priv->pendingMaps--; - priv->mapNum = priv->screen->mapNum ()++; + priv->mapNum = priv->screen->priv->mapNum++; if (priv->struts) - priv->screen->updateWorkarea (); + priv->screen->priv->updateWorkarea (); if (windowClass () == InputOnly) return; @@ -1153,12 +1153,12 @@ CompWindow::map () priv->attrib.map_state = IsViewable; if (!overrideRedirect ()) - priv->screen->setWmState (NormalState, priv->id); + priv->screen->priv->setWmState (NormalState, priv->id); priv->invisible = true; priv->alive = true; - priv->lastPong = priv->screen->lastPing (); + priv->lastPong = priv->screen->priv->lastPing; updateRegion (); updateSize (); @@ -1169,10 +1169,10 @@ CompWindow::map () XMapWindow (priv->screen->dpy (), priv->wrapper); } - priv->screen->updateClientList (); + priv->screen->priv->updateClientList (); if (priv->type & CompWindowTypeDesktopMask) - priv->screen->desktopWindowCount ()++; + priv->screen->priv->desktopWindowCount++; if (priv->protocols & CompWindowProtocolSyncRequestMask) { @@ -1202,13 +1202,13 @@ CompWindow::unmap () return; if (priv->struts) - priv->screen->updateWorkarea (); + priv->screen->priv->updateWorkarea (); if (priv->attrib.map_state != IsViewable) return; if (priv->type == CompWindowTypeDesktopMask) - priv->screen->desktopWindowCount ()--; + priv->screen->priv->desktopWindowCount--; priv->attrib.map_state = IsUnmapped; @@ -1219,7 +1219,7 @@ CompWindow::unmap () priv->attrib.width, ++priv->attrib.height - 1, priv->attrib.border_width); - priv->screen->updateClientList (); + priv->screen->priv->updateClientList (); windowNotify (CompWindowNotifyUnmap); } @@ -1242,7 +1242,7 @@ PrivateWindow::restack (Window aboveId) screen->unhookWindow (window); screen->insertWindow (window, aboveId); - screen->updateClientList (); + screen->priv->updateClientList (); window->windowNotify (CompWindowNotifyRestack); @@ -1499,7 +1499,7 @@ CompWindow::circulate (XCirculateEvent *ce) Window newAboveId; if (ce->place == PlaceOnTop) - newAboveId = priv->screen->getTopWindow (); + newAboveId = priv->screen->priv->getTopWindow (); else newAboveId = 0; @@ -3039,7 +3039,7 @@ CompWindow::activate () { WRAPABLE_HND_FUNC(3, activate) - priv->screen->setCurrentDesktop (priv->desktop); + priv->screen->priv->setCurrentDesktop (priv->desktop); priv->screen->forEachWindow ( boost::bind (PrivateWindow::revealAncestors, _1, this)); @@ -4042,7 +4042,7 @@ CompWindow::processMap () priv->initialTimestampSet = false; - priv->screen->applyStartupProperties (this); + priv->screen->priv->applyStartupProperties (this); if (!priv->placed) { @@ -4362,8 +4362,8 @@ CompWindow::sizeHints () void CompWindow::updateMwmHints () { - priv->screen->getMwmHints (priv->id, &priv->mwmFunc, - &priv->mwmDecor); + priv->screen->priv->getMwmHints (priv->id, &priv->mwmFunc, + &priv->mwmDecor); recalcActions (); } @@ -4452,7 +4452,7 @@ CompWindow::CompWindow (CompScreen *screen, GrabModeSync, GrabModeSync, None, None); priv->alpha = (depth () == 32); - priv->lastPong = screen->lastPing (); + priv->lastPong = screen->priv->lastPing; if (screen->XShape ()) XShapeSelectInput (screen->dpy (), id, ShapeNotifyMask); @@ -4476,7 +4476,7 @@ CompWindow::CompWindow (CompScreen *screen, XUnionRegion (&rect, priv->region, priv->region); /* need to check for DisplayModal state on all windows */ - priv->state = screen->getWindowState (priv->id); + priv->state = screen->priv->getWindowState (priv->id); updateClassHints (); } @@ -4485,8 +4485,8 @@ CompWindow::CompWindow (CompScreen *screen, priv->attrib.map_state = IsUnmapped; } - priv->wmType = screen->getWindowType (priv->id); - priv->protocols = screen->getProtocols (priv->id); + priv->wmType = screen->priv->getWindowType (priv->id); + priv->protocols = screen->priv->getProtocols (priv->id); if (!overrideRedirect ()) { @@ -4501,7 +4501,7 @@ CompWindow::CompWindow (CompScreen *screen, recalcType (); - screen->getMwmHints (priv->id, &priv->mwmFunc, &priv->mwmDecor); + screen->priv->getMwmHints (priv->id, &priv->mwmFunc, &priv->mwmDecor); if (!(priv->type & (CompWindowTypeDesktopMask | CompWindowTypeDockMask))) { @@ -4527,7 +4527,7 @@ CompWindow::CompWindow (CompScreen *screen, { priv->managed = true; - if (screen->getWmState (priv->id) == IconicState) + if (screen->priv->getWmState (priv->id) == IconicState) { if (priv->state & CompWindowStateShadedMask) priv->shaded = true; @@ -4568,12 +4568,12 @@ CompWindow::CompWindow (CompScreen *screen, XUnmapWindow (screen->dpy (), priv->id); - screen->setWindowState (priv->state, priv->id); + screen->priv->setWindowState (priv->state, priv->id); } } else if (!overrideRedirect ()) { - if (screen->getWmState (priv->id) == IconicState) + if (screen->priv->getWmState (priv->id) == IconicState) { priv->managed = true; priv->placed = true; @@ -4639,14 +4639,14 @@ CompWindow::~CompWindow () if (priv->attrib.map_state == IsViewable) { if (priv->type == CompWindowTypeDesktopMask) - priv->screen->desktopWindowCount ()--; + priv->screen->priv->desktopWindowCount--; if (priv->destroyed && priv->struts) - priv->screen->updateWorkarea (); + priv->screen->priv->updateWorkarea (); } if (priv->destroyed) - priv->screen->updateClientList (); + priv->screen->priv->updateClientList (); CompPlugin::windowFiniPlugins (this); |