summaryrefslogtreecommitdiff
authorSam Spilsbury <smspillaz@gmail.com>2010-02-07 09:41:33 (GMT)
committer Sam Spilsbury <smspillaz@gmail.com>2010-02-07 09:41:33 (GMT)
commita89f2bb3876f5afaaa5e9b2614263439b56f1c19 (patch) (side-by-side diff)
treecb0fff68560cfb46ef06b058f88587ef6b6d6b59
parent53f42dc71561797da22b95ceba0a166c775e0e8a (diff)
downloadgroup-a89f2bb3876f5afaaa5e9b2614263439b56f1c19.tar.gz
group-a89f2bb3876f5afaaa5e9b2614263439b56f1c19.tar.bz2
Code cleanup
-rw-r--r--src/actions.cpp69
-rw-r--r--src/cairo.cpp14
-rw-r--r--src/group.cpp8
-rw-r--r--src/group.h51
-rw-r--r--src/init.cpp8
-rw-r--r--src/layers.cpp13
-rw-r--r--src/queues.cpp18
-rw-r--r--src/screen.cpp66
-rw-r--r--src/selection.cpp73
-rw-r--r--src/tab.cpp14
-rw-r--r--src/tabbar.cpp198
-rw-r--r--src/window.cpp158
12 files changed, 352 insertions, 338 deletions
diff --git a/src/actions.cpp b/src/actions.cpp
index 8df0f0e..0390190 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -83,7 +83,7 @@ GroupScreen::select (CompAction *action,
return TRUE;
}
- return FALSE;
+ return false;
}
/*
@@ -282,7 +282,7 @@ GroupScreen::setIgnore (CompAction *action,
if (state & CompAction::StateInitKey)
action->setState (action->state () | CompAction::StateTermKey);
- return FALSE;
+ return false;
}
bool
@@ -290,11 +290,11 @@ GroupScreen::unsetIgnore (CompAction *action,
CompAction::State state,
CompOption::Vector &options)
{
- ignoreMode = FALSE;
+ ignoreMode = false;
action->setState (action->state () & ~CompAction::StateTermKey);
- return FALSE;
+ return false;
}
@@ -303,7 +303,7 @@ GroupScreen::initTab (CompAction *action,
CompAction::State state,
CompOption::Vector &options)
{
- Bool allowUntab = TRUE;
+ bool allowUntab = TRUE;
CompWindow *w = screen->findWindow (CompOption::getIntOptionNamed (options,
"window",
@@ -319,7 +319,7 @@ GroupScreen::initTab (CompAction *action,
/* If the window was selected, we don't want to
untab the group, because the user probably
wanted to tab the selected windows. */
- allowUntab = FALSE;
+ allowUntab = false;
}
if (!gw->group)
@@ -341,22 +341,23 @@ GroupScreen::initTab (CompAction *action,
* GroupScreen::changeTabLeft
*
*/
-Bool
+bool
GroupScreen::changeTabLeft (CompAction *action,
CompAction::State state,
CompOption::Vector &options)
{
CompWindow *topTab;
+ Tab *prev;
CompWindow *w = screen->findWindow (CompOption::getIntOptionNamed (options,
"window",
0));
topTab = w;
- if (!w)
+ if (!topTab)
return TRUE;
- GROUP_WINDOW (w);
+ GROUP_WINDOW (topTab);
if (!gw->tab || !gw->group || !gw->group->tabBar)
return TRUE;
@@ -372,27 +373,9 @@ GroupScreen::changeTabLeft (CompAction *action,
gw = GroupWindow::get (topTab);
- std::list <Tab *> &tabs = gw->group->tabBar->tabs;
- std::list <Tab *>::iterator currentTab = std::find (tabs.begin (),
- tabs.end (),
- gw->group->tabBar->topTab);
-
- /* FIXME: this is a bit of black magic */
-
- if (currentTab != tabs.end ()) // Did we find a tab?
- {
- if (currentTab != tabs.begin ()) // Is this not the first
- {
- currentTab--;
- return gw->group->tabBar->changeTab (*(currentTab),
- TabBar::RotateLeft);
- }
- else
- return gw->group->tabBar->changeTab (tabs.back (),
- TabBar::RotateLeft);
- }
-
- return true;
+ gw->group->tabBar->getPrevTab (gw->group->tabBar->topTab, prev);
+
+ return gw->group->tabBar->changeTab (prev, TabBar::RotateLeft);
}
/*
@@ -405,6 +388,7 @@ GroupScreen::changeTabRight (CompAction *action,
CompOption::Vector &options)
{
CompWindow *topTab;
+ Tab *next;
CompWindow *w = screen->findWindow (CompOption::getIntOptionNamed (options,
"window",
@@ -429,27 +413,8 @@ GroupScreen::changeTabRight (CompAction *action,
}
gw = GroupWindow::get (topTab);
-
- std::list <Tab *> &tabs = gw->group->tabBar->tabs;
- std::list <Tab *>::iterator currentTab = std::find (tabs.begin (),
- tabs.end (),
- gw->group->tabBar->topTab);
-
- /* FIXME: this is a bit of black magic */
-
- if (currentTab != tabs.end ()) // Did we find a tab?
- {
- currentTab++;
-
- if (currentTab != tabs.end ()) // Is this not the last tab?
- return gw->group->tabBar->changeTab (*(currentTab),
- TabBar::RotateRight);
-
- else
- return gw->group->tabBar->changeTab (tabs.front (),
- TabBar::RotateRight);
- }
-
- return true;
+ gw->group->tabBar->getNextTab (gw->group->tabBar->topTab, next);
+
+ return gw->group->tabBar->changeTab (next, TabBar::RotateRight);
}
diff --git a/src/cairo.cpp b/src/cairo.cpp
index b9a134d..8666adf 100644
--- a/src/cairo.cpp
+++ b/src/cairo.cpp
@@ -24,18 +24,6 @@
#include "group.h"
-Layer::Layer (int width, int height) :
- state (PaintOff),
- animationTime (0),
- texWidth (width),
- texHeight (height)
-{
-}
-
-Layer::~Layer ()
-{
-}
-
TextLayer::TextLayer () :
Layer (0, 0),
pixmap (None)
@@ -604,7 +592,7 @@ CairoLayer::renderTabBarBackground (TabBar *tb)
animationProgress = tb->bgAnimationTime /
(gs->optionGetReflexTime () * 1000.0);
- reflexWidth = (tb->tabs.size () / 2.0) * 30;
+ reflexWidth = (tb->size () / 2.0) * 30;
posX = (width + reflexWidth * 2.0) * animationProgress;
alpha = sin (PI * animationProgress) * 0.55;
if (alpha <= 0)
diff --git a/src/group.cpp b/src/group.cpp
index 0fd5ee8..c38b121 100644
--- a/src/group.cpp
+++ b/src/group.cpp
@@ -137,7 +137,7 @@ Group::Group (unsigned int initialIdent) :
{
/* we got no valid group Id passed, so find out a new valid
unique one */
- bool invalidID = FALSE;
+ bool invalidID = false;
identifier = !gs->groups.empty () ? gs->groups.front ()->identifier : 0;
do
@@ -199,7 +199,7 @@ Group::destroy (bool immediate)
gw->window->updateWindowOutputExtents ();
gw->updateProperty ();
- if (gs->optionGetAutotabCreate () && gw->is ())
+ if (gs->optionGetAutotabCreate () && gw->isGroupable ())
{
Selection sel;
Group *group;
@@ -272,7 +272,7 @@ Group::addWindow (CompWindow *w)
if (topTabWin)
{
if (!gw->tab)
- gw->tab = new Tab (this, w);
+ tabBar->createTab (w);
gw->destination.setX (WIN_CENTER_X (topTabWin) -
(WIN_WIDTH (w) / 2));
@@ -288,7 +288,7 @@ Group::addWindow (CompWindow *w)
gw->animateState = IS_ANIMATED;
- startTabbingAnimation (TRUE);
+ startTabbingAnimation (true);
gw->cWindow->addDamage ();
}
diff --git a/src/group.h b/src/group.h
index 385dee6..d42c232 100644
--- a/src/group.h
+++ b/src/group.h
@@ -234,7 +234,6 @@ class Tab
};
public:
- Tab (Group *, CompWindow *w);
~Tab ();
void
@@ -260,9 +259,14 @@ class Tab
int speed;
float msSinceLastMove;
private:
+
+ Tab (Group *, CompWindow *w);
+
+ friend class TabBar;
};
-class TabBar
+class TabBar :
+ public Tab::List
{
public:
typedef enum _GroupAnimationType {
@@ -297,8 +301,6 @@ class TabBar
TabBar (Group *, CompWindow *);
~TabBar ();
- Tab::List tabs;
-
Tab *hoveredSlot;
Tab *textSlot;
@@ -368,13 +370,12 @@ class TabBar
/* Tab placement logic */
+ Tab * createTab (CompWindow *w);
void insertTabAfter (Tab *tab, Tab *prev);
void insertTabBefore (Tab *tab, Tab *next);
void insertTab (Tab *tab);
void unhookTab (Tab *tab, bool temporary);
void deleteTab (Tab *tab);
- Tab *
- createTab (CompWindow *);
/* Physics engine */
@@ -483,7 +484,7 @@ class Group
int dy);
void
- startTabbingAnimation (Bool tab);
+ startTabbingAnimation (bool tab);
private:
@@ -543,7 +544,8 @@ class Selection :
class GlowTexture
{
- public:
+ public: bool
+ inRegion (CompRegion, float);
class Properties {
public:
@@ -606,8 +608,8 @@ class GroupScreen :
CompWindow *w;
int dx;
int dy;
- Bool immediate;
- Bool sync;
+ bool immediate;
+ bool sync;
} PendingMoves;
typedef struct _PendingGrabs {
@@ -761,7 +763,7 @@ class GroupScreen :
CompAction::State state,
CompOption::Vector &options);
- Bool
+ bool
changeTabLeft (CompAction *action,
CompAction::State state,
CompOption::Vector &options);
@@ -797,14 +799,14 @@ class GroupScreen :
CompTimer showDelayTimeoutHandle;
/* For selection */
- Bool painted;
+ bool painted;
int vpX, vpY;
int x1, y1, x2, y2;
/* For d&d */
Tab *draggedSlot;
CompTimer dragHoverTimeoutHandle;
- Bool dragged;
+ bool dragged;
int prevX, prevY; /* Buffer for mouse coordinates */
MousePoller poller;
@@ -873,7 +875,7 @@ class GroupWindow :
Selection *selection;
Group *group;
- Bool inSelection;
+ bool inSelection;
/* To prevent freeing the group
property in groupFiniWindow. */
@@ -901,14 +903,18 @@ class GroupWindow :
void
updateProperty ();
+ bool checkProperty (long int &id,
+ bool &tabbed,
+ GLushort *color);
+
void
select ();
-
+
bool
- is ();
+ inRegion (CompRegion, float);
bool
- inRegion (CompRegion, float);
+ isGroupable ();
void
moveNotify (int, int, bool);
@@ -916,10 +922,6 @@ class GroupWindow :
void
resizeNotify (int, int, int, int);
-
- void
- getOutputExtents (CompWindowExtents &);
-
void
grabNotify (int, int,
unsigned int,
@@ -938,6 +940,9 @@ class GroupWindow :
void
activate ();
+ void
+ getOutputExtents (CompWindowExtents &);
+
bool
glDraw (const GLMatrix &,
GLFragment::Attrib &,
@@ -954,10 +959,6 @@ class GroupWindow :
damageRect (bool,
const CompRect &);
- bool checkProperty (long int &id,
- bool &tabbed,
- GLushort *color);
-
void deleteGroupWindow ();
void removeFromGroup ();
diff --git a/src/init.cpp b/src/init.cpp
index fee1b31..8d493c9 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -186,7 +186,7 @@ GroupScreen::applyInitialActions ()
cScreen->damageScreen ();
}
- if (optionGetAutotabCreate () && gw->is ())
+ if (optionGetAutotabCreate () && gw->isGroupable ())
{
if (!gw->group && (gw->windowState == GroupWindow::WindowNormal))
{
@@ -376,10 +376,10 @@ GroupWindow::GroupWindow (CompWindow *window) :
GroupWindow::~GroupWindow ()
{
- /*if (windowHideInfo)
- setVisibility (true);*/
+ if (windowHideInfo)
+ setVisibility (true);
- readOnlyProperty = TRUE;
+ readOnlyProperty = true;
if (glowQuads)
delete[] glowQuads;
diff --git a/src/layers.cpp b/src/layers.cpp
index 6efa9dc..4211187 100644
--- a/src/layers.cpp
+++ b/src/layers.cpp
@@ -26,6 +26,18 @@
#include "group.h"
+Layer::Layer (int width, int height) :
+ state (PaintOff),
+ animationTime (0),
+ texWidth (width),
+ texHeight (height)
+{
+}
+
+Layer::~Layer ()
+{
+}
+
void
Layer::draw (CompRegion &box,
const float &wScale,
@@ -73,7 +85,6 @@ Layer::draw (CompRegion &box,
matrix.x0 -= boxRect.x1 () * matrix.xx;
matrix.y0 -= boxRect.y1 () * matrix.yy;
- /* FIXME */
GLWindow::get (tb->topTab->window)->geometry ().reset ();
matricies.push_back (matrix);
diff --git a/src/queues.cpp b/src/queues.cpp
index 462af6e..a06ede6 100644
--- a/src/queues.cpp
+++ b/src/queues.cpp
@@ -82,7 +82,7 @@ GroupScreen::dequeueMoveNotifies ()
{
GROUP_WINDOW (move->w);
- gw->needsPosSync = TRUE;
+ gw->needsPosSync = true;
pendingSync->w = move->w;
pendingSyncs.push_back (pendingSync);
@@ -151,7 +151,7 @@ GroupScreen::enqueueGrabNotify (CompWindow *w,
void
GroupScreen::dequeueGrabNotifies ()
{
- queued = TRUE;
+ queued = true;
while (!pendingGrabs.empty ())
{
@@ -164,7 +164,7 @@ GroupScreen::dequeueGrabNotifies ()
delete grab;
}
- queued = FALSE;
+ queued = false;
}
void
@@ -188,7 +188,7 @@ GroupScreen::enqueueUngrabNotify (CompWindow *w)
void
GroupScreen::dequeueUngrabNotifies ()
{
- queued = TRUE;
+ queued = true;
while (!pendingUngrabs.empty ())
{
@@ -201,7 +201,7 @@ GroupScreen::dequeueUngrabNotifies ()
delete ungrab;
}
- queued = FALSE;
+ queued = false;
}
void
@@ -235,16 +235,16 @@ GroupScreen::dequeueWindowNotifies ()
switch (notify->n)
{
case CompWindowNotifyMinimize:
- gw->group->minimizeWindows (notify->w, TRUE);
+ gw->group->minimizeWindows (notify->w, true);
break;
case CompWindowNotifyUnminimize:
- gw->group->minimizeWindows (notify->w, FALSE);
+ gw->group->minimizeWindows (notify->w, false);
break;
case CompWindowNotifyShade:
- gw->group->shadeWindows (notify->w, TRUE);
+ gw->group->shadeWindows (notify->w, true);
break;
case CompWindowNotifyUnshade:
- gw->group->shadeWindows (notify->w, FALSE);
+ gw->group->shadeWindows (notify->w, false);
break;
case CompWindowNotifyRestack:
if (gw->group && !gw->group->tabBar &&
diff --git a/src/screen.cpp b/src/screen.cpp
index f00bd64..441651b 100644
--- a/src/screen.cpp
+++ b/src/screen.cpp
@@ -87,7 +87,7 @@ GroupScreen::handleMotionEvent (int xRoot,
GROUP_WINDOW (draggedSlot->window);
- dragged = TRUE;
+ dragged = true;
foreach (group, groups)
{
@@ -161,13 +161,13 @@ GroupScreen::handleButtonPressEvent (XEvent *event)
switch (button) {
case Button1:
{
- foreach (Tab *tab, group->tabBar->tabs)
+ foreach (Tab *tab, *group->tabBar)
{
if (tab->region.contains (CompPoint (xRoot, yRoot)))
{
draggedSlot = tab;
/* The slot isn't dragged yet */
- dragged = FALSE;
+ dragged = false;
prevX = xRoot;
prevY = yRoot;
@@ -183,7 +183,7 @@ GroupScreen::handleButtonPressEvent (XEvent *event)
case Button5:
{
CompWindow *ftopTab = NULL;
- Tab::List &tabs = group->tabBar->tabs;
+ Tab::List &tabs = (Tab::List &) *group->tabBar;
GroupWindow *gw;
if (group->tabBar->nextTopTab)
@@ -245,8 +245,8 @@ GroupScreen::handleButtonReleaseEvent (XEvent *event)
{
int vx, vy;
CompRegion newRegion;
- Bool inserted = FALSE;
- Bool wasInTabBar = FALSE;
+ Bool inserted = false;
+ Bool wasInTabBar = false;
if (event->xbutton.button != 1)
return;
@@ -302,10 +302,10 @@ GroupScreen::handleButtonReleaseEvent (XEvent *event)
continue;
}
- wasInTabBar = TRUE;
+ wasInTabBar = true;
- for (it = group->tabBar->tabs.begin ();
- it != group->tabBar->tabs.end ();
+ for (it = group->tabBar->begin ();
+ it != group->tabBar->end ();
it++)
{
Tab *tab = *it;
@@ -321,10 +321,10 @@ GroupScreen::handleButtonReleaseEvent (XEvent *event)
continue;
- if (!group->tabBar->tabs.getPrevTab (tab, prevTab))
+ if (!group->tabBar->getPrevTab (tab, prevTab))
prevTab = NULL;
- if (!group->tabBar->tabs.getNextTab (tab, nextTab))
+ if (!group->tabBar->getNextTab (tab, nextTab))
nextTab = NULL;
if (prevTab && prevTab != draggedSlot)
@@ -332,8 +332,8 @@ GroupScreen::handleButtonReleaseEvent (XEvent *event)
rect.setX (prevTab->region.boundingRect ().x2 ());
}
else if (prevTab && prevTab == draggedSlot
- && draggedSlot->bar->tabs.getPrevTab (draggedSlot,
- draggedSlotSideTab))
+ && draggedSlot->bar->getPrevTab (draggedSlot,
+ draggedSlotSideTab))
{
rect.setX (draggedSlotSideTab->region.boundingRect ().x2 ());
}
@@ -348,8 +348,8 @@ GroupScreen::handleButtonReleaseEvent (XEvent *event)
rect.x ());
}
else if (nextTab && nextTab == draggedSlot &&
- draggedSlot->bar->tabs.getNextTab (draggedSlot,
- draggedSlotSideTab))
+ draggedSlot->bar->getNextTab (draggedSlot,
+ draggedSlotSideTab))
{
rect.setWidth (draggedSlotSideTab->region.boundingRect ().x1 () -
rect.x ());
@@ -407,11 +407,11 @@ GroupScreen::handleButtonReleaseEvent (XEvent *event)
}
}
else
- group->tabBar->unhookTab (draggedSlot, TRUE);
+ group->tabBar->unhookTab (draggedSlot, true);
draggedSlot = NULL;
- dragged = FALSE;
- inserted = TRUE;
+ dragged = false;
+ inserted = true;
if ((tmpDraggedTab->region.boundingRect ().x1 () +
tmpDraggedTab->region.boundingRect ().x2 () + (2 * vx)) / 2 >
@@ -431,9 +431,9 @@ GroupScreen::handleButtonReleaseEvent (XEvent *event)
foreach (tmpGroup, groups)
{
if (group == tmpGroup && tmpGroup->tabBar)
- tmpGroup->tabBar->setVisibility (TRUE, 0);
+ tmpGroup->tabBar->setVisibility (true, 0);
else if (tmpGroup->tabBar)
- tmpGroup->tabBar->setVisibility (FALSE, PERMANENT);
+ tmpGroup->tabBar->setVisibility (false, PERMANENT);
}
break;
@@ -453,11 +453,11 @@ GroupScreen::handleButtonReleaseEvent (XEvent *event)
foreach (tmpGroup, groups)
{
if (tmpGroup->tabBar)
- tmpGroup->tabBar->setVisibility (FALSE, PERMANENT);
+ tmpGroup->tabBar->setVisibility (false, PERMANENT);
}
draggedSlot = NULL;
- dragged = FALSE;
+ dragged = false;
if (optionGetDndUngroupWindow () && !wasInTabBar)
{
@@ -545,7 +545,7 @@ GroupScreen::handleEvent (XEvent *event)
{
/* on unmap of the top tab, hide the tab bar and the
input prevention window */
- gw->group->tabBar->setVisibility (FALSE, PERMANENT);
+ gw->group->tabBar->setVisibility (false, PERMANENT);
}
if (!w->pendingUnmaps ())
{
@@ -571,7 +571,7 @@ GroupScreen::handleEvent (XEvent *event)
if (gw->group && gw->group->tabBar &&
!IS_TOP_TAB (w, gw->group))
{
- gw->group->tabBar->checkFocusAfterTabChange = TRUE;
+ gw->group->tabBar->checkFocusAfterTabChange = true;
gw->group->tabBar->changeTab (gw->tab,
TabBar::RotateUncertain);
}
@@ -834,7 +834,7 @@ GroupScreen::glPaintOutput (const GLScreenPaintAttrib &attrib,
{
bool status;
- painted = FALSE;
+ painted = false;
vpX = screen->vp ().x ();
vpY = screen->vp ().y ();
@@ -886,7 +886,7 @@ GroupScreen::glPaintOutput (const GLScreenPaintAttrib &attrib,
}
else if (grabState == ScreenGrabSelect)
{
- masterSelectionRect.paint (attrib, transform, output, FALSE);
+ masterSelectionRect.paint (attrib, transform, output, false);
}
}
@@ -911,7 +911,7 @@ GroupScreen::glPaintTransformedOutput (const GLScreenPaintAttrib &attrib,
if ((vpX == screen->vp ().x ()) && (vpY == screen->vp ().y ()))
{
- painted = TRUE;
+ painted = true;
if ((grabState == ScreenGrabTabDrag) &&
draggedSlot && dragged)
@@ -930,7 +930,7 @@ GroupScreen::glPaintTransformedOutput (const GLScreenPaintAttrib &attrib,
}
else if (grabState == ScreenGrabSelect)
{
- masterSelectionRect.paint (attrib, transform, output, FALSE);
+ masterSelectionRect.paint (attrib, transform, output, false);
}
}
}
@@ -954,12 +954,12 @@ GroupScreen::donePaint ()
cScreen->damageScreen ();
else if (group->tabBar)
{
- Bool needDamage = FALSE;
+ Bool needDamage = false;
if ((group->tabBar->state == Layer::PaintFadeIn) ||
(group->tabBar->state == Layer::PaintFadeOut))
{
- needDamage = TRUE;
+ needDamage = true;
}
if (group->tabBar->textLayer)
@@ -967,15 +967,15 @@ GroupScreen::donePaint ()
if ((group->tabBar->textLayer->state == Layer::PaintFadeIn) ||
(group->tabBar->textLayer->state == Layer::PaintFadeOut))
{
- needDamage = TRUE;
+ needDamage = true;
}
}
if (group->tabBar->bgAnimation)
- needDamage = TRUE;
+ needDamage = true;
if (draggedSlot)
- needDamage = TRUE;
+ needDamage = true;
if (needDamage)
group->tabBar->damageRegion ();
diff --git a/src/selection.cpp b/src/selection.cpp
index d9b24b3..4d13bc0 100644
--- a/src/selection.cpp
+++ b/src/selection.cpp
@@ -35,7 +35,7 @@ Group *
Selection::toGroup ()
{
Group *retGroup = NULL;
- Bool tabbed = FALSE;
+ bool tabbed = false;
/* check if there is an existing group or if the group is tabbed */
@@ -49,25 +49,13 @@ Selection::toGroup ()
retGroup = gw->group;
if (retGroup->tabBar)
- tabbed = TRUE;
+ tabbed = true;
}
}
if (!retGroup)
retGroup = Group::create (0);
- /* we need to do one first to get the pointer of a new group */
-/* cw = this->front ();
- GROUP_WINDOW (cw);
-
- if (gw->group && (group != gw->group))
- gw->removeFromGroup ();
- group->addWindow (cw, 0);
- gw->cWindow->addDamage ();
-
- gw->inSelection = false;
- group = gw->group;*/
-
foreach (CompWindow *w, *this)
{
GROUP_WINDOW (w);
@@ -77,7 +65,7 @@ Selection::toGroup ()
retGroup->addWindow (w);
gw->cWindow->addDamage ();
- gw->inSelection = FALSE;
+ gw->inSelection = false;
gw->updateProperty ();
@@ -266,7 +254,7 @@ Selection::Rect::toSelection ()
GROUP_WINDOW (w);
- if (gw->is () &&
+ if (gw->isGroupable () &&
gw->inRegion (reg, precision))
{
/*if (gw->group && groupFindGroupInWindows (gw->group, ret, count))
@@ -278,3 +266,56 @@ Selection::Rect::toSelection ()
return sel;
}
+
+
+/*
+ * GroupWindow::inRegion ()
+ *
+ * Determine if the window is in our selection region
+ *
+ */
+
+bool
+GroupWindow::inRegion (CompRegion reg,
+ float precision)
+{
+ CompRegion buf;
+ int area = 0;
+
+ buf = reg.intersected (window->region ());
+
+ /* buf area */
+ area = buf.boundingRect ().width () * buf.boundingRect ().height ();
+
+ if (area >= WIN_WIDTH (window) * WIN_HEIGHT (window) * precision)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+/*
+ * GroupWindow::select
+ *
+ * Description: add this window to the selection
+ *
+ */
+
+void
+GroupWindow::select ()
+{
+ GROUP_SCREEN (screen);
+
+ if (!inSelection)
+ {
+ gs->masterSelection.push_back (window);
+ selection = &gs->masterSelection;
+ }
+ else
+ {
+ selection = NULL;
+ gs->masterSelection.remove (window);
+ }
+ inSelection = !inSelection;
+}
diff --git a/src/tab.cpp b/src/tab.cpp
index 0ec0c21..2de3319 100644
--- a/src/tab.cpp
+++ b/src/tab.cpp
@@ -112,7 +112,7 @@ Group::tab (CompWindow *main)
if (!HAS_TOP_WIN (this))
return;
- foreach (Tab *tab, tabBar->tabs)
+ foreach (Tab *tab, *tabBar)
{
CompWindow *cw = tab->window;
@@ -122,7 +122,7 @@ Group::tab (CompWindow *main)
{
cw->move (gw->destination.x () - WIN_X (cw),
gw->destination.y () - WIN_Y (cw),
- FALSE);
+ false);
}
/* center the window to the main window */
@@ -180,7 +180,7 @@ Group::untab ()
tabBar->lastTopTab = TOP_TAB (this);
tabBar->topTab = NULL;
- foreach (Tab *tab, tabBar->tabs)
+ foreach (Tab *tab, *tabBar)
{
CompWindow *cw = tab->window;
@@ -188,11 +188,11 @@ Group::untab ()
if (gw->animateState & (IS_ANIMATED | FINISHED_ANIMATION))
{
- gs->queued = TRUE;
+ gs->queued = true;
cw->move (gw->destination.x () - WIN_X (cw),
gw->destination.y () - WIN_Y (cw),
false);
- gs->queued = FALSE;
+ gs->queued = false;
}
gw->setVisibility (true);
@@ -238,7 +238,7 @@ bool
GroupScreen::dragHoverTimeout (CompWindow *w)
{
if (!w)
- return FALSE;
+ return false;
GROUP_WINDOW (w);
@@ -252,7 +252,7 @@ GroupScreen::dragHoverTimeout (CompWindow *w)
w->activate ();
- return FALSE;
+ return false;
}
/* Tab::List::getNextTab
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
index 4cca831..7f49899 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -65,7 +65,7 @@ TabBar::TabBar (Group *g, CompWindow *main) :
foreach (CompWindow *w, group->windows)
{
- new Tab (group, w); // FIXME
+ createTab (w);
}
recalcPos (WIN_CENTER_X (main), WIN_X (main), WIN_X (main) +
@@ -155,7 +155,7 @@ TabBar::changeTab (Tab *fTopTab,
if (!fTopTab)
{
- return TRUE;
+ return true;
}
w = fTopTab->window;
@@ -167,17 +167,17 @@ TabBar::changeTab (Tab *fTopTab,
if (!group || group->tabBar->tabbingState != NoTabbing)
{
- return TRUE;
+ return true;
}
if (changeState == NoTabChange && topTab == fTopTab)
{
- return TRUE;
+ return true;
}
if (changeState != NoTabChange && nextTopTab == fTopTab)
{
- return TRUE;
+ return true;
}
oldTopTab = topTab ? topTab->window : NULL;
@@ -194,7 +194,7 @@ TabBar::changeTab (Tab *fTopTab,
if (topTab)
{
- foreach (Tab *tab, tabs)
+ foreach (Tab *tab, *this)
{
if (tab == topTab)
break;
@@ -204,7 +204,7 @@ TabBar::changeTab (Tab *fTopTab,
}
- foreach (Tab *tab, tabs)
+ foreach (Tab *tab, *this)
{
if (tab == topTab)
break;
@@ -219,7 +219,7 @@ TabBar::changeTab (Tab *fTopTab,
/* check if the opposite direction is shorter */
if ((unsigned int) abs (distanceNew - distanceOld) >
- (group->tabBar->tabs.size () / 2))
+ (size () / 2))
changeAnimationDirection *= -1;
}
@@ -259,7 +259,7 @@ TabBar::changeTab (Tab *fTopTab,
if (fTopTab != nextTopTab)
{
- gw->setVisibility (TRUE);
+ gw->setVisibility (true);
if (oldTopTab)
{
int dx, dy;
@@ -267,10 +267,10 @@ TabBar::changeTab (Tab *fTopTab,
dx = WIN_CENTER_X (oldTopTab) - WIN_CENTER_X (w);
dy = WIN_CENTER_Y (oldTopTab) - WIN_CENTER_Y (w);
- gs->queued = TRUE;
- w->move (dx, dy, FALSE);
+ gs->queued = true;
+ w->move (dx, dy, false);
w->syncPosition ();
- gs->queued = FALSE;
+ gs->queued = false;
}
if (HAS_PREV_TOP_WIN (group))
@@ -279,12 +279,12 @@ TabBar::changeTab (Tab *fTopTab,
the second half will be PaintFadeOut */
changeAnimationTime =
gs->optionGetChangeAnimationTime () * 500;
- //groupTabChangeActivateEvent (s, TRUE); // FIXME
+ //groupTabChangeActivateEvent (s, true); // FIXME
changeState = TabChangeOldOut;
}
else
{
- Bool activate;
+ bool activate;
/* No window to do animation with. */
if (HAS_TOP_WIN (group))
@@ -308,11 +308,11 @@ TabBar::changeTab (Tab *fTopTab,
if (activate)
w->activate ();
- checkFocusAfterTabChange = FALSE;
+ checkFocusAfterTabChange = false;
}
}
- return TRUE;
+ return true;
}
/*
@@ -359,7 +359,7 @@ TabBar::recalcPos (int middleX,
int maxX2)
{
CompWindow *topTab;
- Bool isDraggedSlotGroup = FALSE;
+ bool isDraggedSlotGroup = false;
int space, barWidth;
int thumbSize;
int tabsWidth = 0, tabsHeight = 0;
@@ -375,11 +375,11 @@ TabBar::recalcPos (int middleX,
space = gs->optionGetThumbSpace ();
/* calculate the space which the tabs need */
- foreach (Tab *tab, tabs)
+ foreach (Tab *tab, *this)
{
if (tab == gs->draggedSlot && gs->dragged)
{
- isDraggedSlotGroup = TRUE;
+ isDraggedSlotGroup = true;
continue;
}
@@ -391,12 +391,12 @@ TabBar::recalcPos (int middleX,
/* just a little work-a-round for first call
FIXME: remove this! */
thumbSize = gs->optionGetThumbSize ();
- if (!tabs.empty () && tabsWidth <= 0)
+ if (!empty () && tabsWidth <= 0)
{
/* first call */
- tabsWidth = thumbSize * tabs.size ();
+ tabsWidth = thumbSize * size ();
- if (!tabs.empty () && tabsHeight < thumbSize)
+ if (!empty () && tabsHeight < thumbSize)
{
/* we need to do the standard height too */
tabsHeight = thumbSize;
@@ -406,7 +406,7 @@ TabBar::recalcPos (int middleX,
tabsWidth -= thumbSize;
}
- barWidth = space * (tabs.size () + 1) + tabsWidth;
+ barWidth = space * (size () + 1) + tabsWidth;
if (isDraggedSlotGroup)
{
@@ -427,11 +427,11 @@ TabBar::recalcPos (int middleX,
box.setWidth (barWidth);
box.setHeight (space * 2 + tabsHeight);
- resizeRegion (box, TRUE); // TODO
+ resizeRegion (box, true);
/* recalc every slot region */
currentSlot = 0;
- foreach (Tab *tab, tabs)
+ foreach (Tab *tab, *this)
{
if (tab == gs->draggedSlot && gs->dragged)
continue;
@@ -665,7 +665,7 @@ GroupScreen::showDelayTimeout (TabBar *bar)
if (!HAS_TOP_WIN (bar->group))
{
- return FALSE; /* This will free the timer. */
+ return false; /* This will free the timer. */
}
topTab = TOP_TAB (bar->group);
@@ -674,9 +674,9 @@ GroupScreen::showDelayTimeout (TabBar *bar)
bar->recalcPos (mouse.x (), WIN_REAL_X (topTab),
WIN_REAL_X (topTab) + WIN_REAL_WIDTH (topTab));
- bar->setVisibility (TRUE, 0);
+ bar->setVisibility (true, 0);
- return FALSE; /* This will free the timer. */
+ return false; /* This will free the timer. */
}
/*
@@ -689,8 +689,8 @@ GroupScreen::showDelayTimeout (TabBar *bar)
* and PaintPermantOn.
* Currently the mask paramater is mostely used for the PERMANENT mask.
* This mask affects how the visible parameter is handled, for example if
- * visibule is set to TRUE and the mask to PERMANENT state it will set
- * PaintPermanentOn state for the tab bar. When visibile is FALSE, mask 0
+ * visibule is set to true and the mask to PERMANENT state it will set
+ * PaintPermanentOn state for the tab bar. When visibile is false, mask 0
* and the current state of the tab bar is PaintPermanentOn it won't do
* anything because its not strong enough to disable a
* Permanent-State, for those you need the mask.
@@ -716,12 +716,12 @@ TabBar::setVisibility (bool visible,
topTabWin->invisible ())
{
state = Layer::PaintOff;
- switchTopTabInput (TRUE);
+ switchTopTabInput (true);
}
else if (visible && state != Layer::PaintPermanentOn && (mask & PERMANENT))
{
state = Layer::PaintPermanentOn;
- switchTopTabInput (FALSE);
+ switchTopTabInput (false);
}
else if (visible && state == Layer::PaintPermanentOn && !(mask & PERMANENT))
{
@@ -736,7 +736,7 @@ TabBar::setVisibility (bool visible,
bgAnimationTime = gs->optionGetReflexTime () * 1000.0;
}
state = Layer::PaintFadeIn;
- switchTopTabInput (FALSE);
+ switchTopTabInput (false);
}
else if (!visible &&
(state != Layer::PaintPermanentOn || (mask & PERMANENT)) &&
@@ -744,7 +744,7 @@ TabBar::setVisibility (bool visible,
state == Layer::PaintFadeIn))
{
state = Layer::PaintFadeOut;
- switchTopTabInput (TRUE);
+ switchTopTabInput (true);
}
if (state == Layer::PaintFadeIn || state == Layer::PaintFadeOut)
@@ -825,7 +825,7 @@ Group::handleHoverDetection ()
{
TabBar *bar = tabBar;
CompWindow *topTabWin = TOP_TAB (this);
- Bool inLastSlot;
+ bool inLastSlot;
GROUP_SCREEN (screen);
@@ -844,7 +844,7 @@ Group::handleHoverDetection ()
bar->hoveredSlot = NULL;
clip = GroupWindow::get (topTabWin)->getClippingRegion ();
- foreach (Tab *tab, bar->tabs)
+ foreach (Tab *tab, *bar)
{
/* We need to clip the slot region with the clip region first.
This is needed to respect the window stack, so if a window
@@ -1050,7 +1050,7 @@ Group::handleAnimation ()
if (tabBar->changeState == TabBar::TabChangeOldOut && tabBar)
{
CompWindow *top = TOP_TAB (this);
- Bool activate;
+ bool activate;
/* recalc here is needed (for y value)! */
tabBar->recalcPos ((tabBar->region.boundingRect ().x1 () +
@@ -1082,7 +1082,7 @@ Group::handleAnimation ()
if (activate)
top->activate ();
- tabBar->checkFocusAfterTabChange = FALSE;
+ tabBar->checkFocusAfterTabChange = false;
}
if (tabBar->changeState == TabBar::TabChangeNewIn &&
@@ -1090,7 +1090,7 @@ Group::handleAnimation ()
{
int oldChangeAnimationTime = tabBar->changeAnimationTime;
- gs->tabChangeActivateEvent (FALSE);
+ gs->tabChangeActivateEvent (false);
if (tabBar->prevTopTab)
GroupWindow::get (PREV_TOP_TAB (this))->setVisibility (false);
@@ -1119,7 +1119,7 @@ Group::handleAnimation ()
else if (gs->optionGetVisibilityTime () != 0.0f &&
tabBar->changeState == TabBar::NoTabChange)
{
- tabBar->setVisibility (TRUE, PERMANENT | SHOW_BAR_INSTANTLY_MASK);
+ tabBar->setVisibility (true, PERMANENT | SHOW_BAR_INSTANTLY_MASK);
if (tabBar->timeoutHandle.active ())
tabBar->timeoutHandle.stop ();
@@ -1352,7 +1352,7 @@ TabBar::draw (const GLWindowPaintAttrib &wAttrib,
if (gs->optionGetMipmaps ())
gs->gScreen->setTextureFilter (GL_LINEAR_MIPMAP_LINEAR);
- foreach (Tab *tab, tabs)
+ foreach (Tab *tab, *this)
{
if (tab != gs->draggedSlot || !gs->dragged)
{
@@ -1413,10 +1413,10 @@ Group::finishTabbing ()
if (tabBar && tabBar->tabbingState == TabBar::Tabbing)
{
tabBar->tabbingState = TabBar::NoTabbing;
- gs->tabChangeActivateEvent (FALSE);
+ gs->tabChangeActivateEvent (false);
/* tabbing case - hide all non-toptab windows */
- foreach (Tab *tab, tabBar->tabs)
+ foreach (Tab *tab, *tabBar)
{
CompWindow *w = tab->window;
if (!w)
@@ -1427,7 +1427,7 @@ Group::finishTabbing ()
if (tab == tabBar->topTab || (gw->animateState & IS_UNGROUPING))
continue;
- gw->setVisibility (FALSE);
+ gw->setVisibility (false);
}
tabBar->prevTopTab = tabBar->topTab;
@@ -1450,10 +1450,10 @@ Group::finishTabbing ()
it++;
/* move window to target position */
- gs->queued = TRUE;
+ gs->queued = true;
w->move (gw->destination.x () - WIN_X (w),
- gw->destination.y ()- WIN_Y (w), TRUE);
- gs->queued = FALSE;
+ gw->destination.y ()- WIN_Y (w), true);
+ gs->queued = false;
w->syncPosition ();
if (ungroupState == UngroupSingle &&
@@ -1490,7 +1490,7 @@ Group::drawTabAnimation (int msSinceLastPaint)
{
int steps;
float amount, chunk;
- Bool doTabbing;
+ bool doTabbing;
GROUP_SCREEN (screen);
@@ -1502,7 +1502,7 @@ Group::drawTabAnimation (int msSinceLastPaint)
while (steps--)
{
- doTabbing = FALSE;
+ doTabbing = false;
foreach (CompWindow *cw, windows)
{
@@ -1623,7 +1623,7 @@ GroupScreen::updateTabBars (Window enteredWin)
(or left a tab bar), hide the old one */
if (lastHoveredGroup && (hoveredGroup != lastHoveredGroup) &&
lastHoveredGroup->tabBar)
- lastHoveredGroup->tabBar->setVisibility (FALSE, 0);
+ lastHoveredGroup->tabBar->setVisibility (false, 0);
/* if we entered a tab bar (or title bar), show the tab bar */
if (hoveredGroup && HAS_TOP_WIN (hoveredGroup) &&
@@ -1740,10 +1740,10 @@ GroupWindow::constrainMovement (CompRegion constrainRegion,
GROUP_WINDOW (window);
if (!gw->group)
- return FALSE;
+ return false;
if (!dx && !dy)
- return FALSE;
+ return false;
x = gw->orgPos.x () - window->input ().left + dx;
y = gw->orgPos.y () - window->input ().top + dy;
@@ -1851,7 +1851,7 @@ Group::applyConstraining (CompRegion constrainRegion,
*
*/
void
-Group::startTabbingAnimation (Bool tab)
+Group::startTabbingAnimation (bool tab)
{
int dx (0), dy (0);
int constrainStatus;
@@ -1862,13 +1862,13 @@ Group::startTabbingAnimation (Bool tab)
return;
tabBar->tabbingState = (tab) ? TabBar::Tabbing : TabBar::Untabbing;
- gs->tabChangeActivateEvent (TRUE);
+ gs->tabChangeActivateEvent (true);
if (!tab)
{
/* we need to set up the X/Y constraining on untabbing */
CompRegion constrainRegion = gs->getConstrainRegion ();
- Bool constrainedWindows = TRUE;
+ bool constrainedWindows = true;
if (constrainRegion.isEmpty ())
return;
@@ -1886,7 +1886,7 @@ Group::startTabbingAnimation (Bool tab)
loop until all constraining dependencies are met */
while (constrainedWindows)
{
- constrainedWindows = FALSE;
+ constrainedWindows = false;
/* loop through all windows and try to constrain their
animation path (going from gw->orgPos to
gw->destination) to the active screen area */
@@ -1954,7 +1954,7 @@ Group::startTabbingAnimation (Bool tab)
gw->destination.setY (gw->orgPos.y () + dy);
}
- constrainedWindows = TRUE;
+ constrainedWindows = true;
}
}
}
@@ -1975,9 +1975,9 @@ TabBar::damageRegion ()
#define DAMAGE_BUFFER 20
- if (group->tabBar->tabs.size ())
+ if (!empty ())
{
- CompRect tabRect = tabs.front ()->region.boundingRect ();
+ CompRect tabRect = front ()->region.boundingRect ();
bbox.setGeometry (MIN (reg.boundingRect ().x1 (), tabRect.x1 ()),
MIN (reg.boundingRect ().y1 (), tabRect.y1 ()),
MAX (reg.boundingRect ().width (), tabRect.width ()),
@@ -2074,18 +2074,34 @@ TabBar::resizeRegion (CompRect box, bool syncIPW)
}
/*
+ * TabBar::createNewTab (CompWindow *
+ *
+ * Description: Creates a new tab bar slot in the TabBar
+ *
+ */
+Tab *
+TabBar::createTab (CompWindow *w)
+{
+ Tab *t = new Tab (group, w);
+
+ insertTab (t);
+
+ return t;
+}
+
+/*
* groupInsertTabBarSlotBefore
*
*/
void
TabBar::insertTabBefore (Tab *tab, Tab *nextTab)
{
- std::list <Tab *>::iterator it = std::find (tabs.begin (), tabs.end (),
+ std::list <Tab *>::iterator it = std::find (begin (), end (),
nextTab);
it--;
- tabs.insert (it, tab);
+ insert (it, tab);
/* Moving bar->region->extents.x1 / x2 as minX1 / maxX2 will work,
because the tab-bar got wider now, so it will put it in
@@ -2103,12 +2119,12 @@ TabBar::insertTabBefore (Tab *tab, Tab *nextTab)
void
TabBar::insertTabAfter (Tab *tab, Tab *prevTab)
{
- std::list <Tab *>::iterator it = std::find (tabs.begin (), tabs.end (),
+ std::list <Tab *>::iterator it = std::find (begin (), end (),
prevTab);
it++;
- tabs.insert (it, tab);
+ insert (it, tab);
/* Moving bar->region->extents.x1 / x2 as minX1 / maxX2 will work,
because the tab-bar got wider now, so it will put it in the
@@ -2126,7 +2142,7 @@ TabBar::insertTabAfter (Tab *tab, Tab *prevTab)
void
TabBar::insertTab (Tab *tab)
{
- tabs.push_back (tab);
+ push_back (tab);
/* Moving bar->region->extents.x1 / x2 as minX1 / maxX2 will work,
because the tab-bar got wider now, so it will put it in
@@ -2145,18 +2161,18 @@ void
TabBar::unhookTab (Tab *tab,
bool temporary)
{
- Tab::List::iterator tempit = tabs.begin ();
+ Tab::List::iterator tempit = begin ();
CompWindow *w = tab->window;
GROUP_SCREEN (screen);
/* check if slot is not already unhooked */
- tempit = std::find (tabs.begin (), tabs.end (), tab);
+ tempit = std::find (begin (), end (), tab);
- if (tempit == tabs.end ())
+ if (tempit == end ())
return;
- tabs.remove (tab);
+ remove (tab);
if (!temporary)
{
@@ -2168,9 +2184,9 @@ TabBar::unhookTab (Tab *tab,
topTab = NULL;
- if (tabs.getNextTab (tab, next))
+ if (getNextTab (tab, next))
changeTab (next, RotateRight);
- else if (tabs.getPrevTab (tab, prev))
+ else if (getPrevTab (tab, prev))
changeTab (prev, RotateLeft);
if (gs->optionGetUntabOnClose ())
@@ -2219,12 +2235,12 @@ Tab::~Tab ()
GROUP_WINDOW (w);
GROUP_SCREEN (screen);
- bar->tabs.remove (this);
+ bar->remove (this);
if (this == gs->draggedSlot)
{
gs->draggedSlot = NULL;
- gs->dragged = FALSE;
+ gs->dragged = false;
if (gs->grabState == GroupScreen::ScreenGrabTabDrag)
gs->grabScreen (GroupScreen::ScreenGrabNone);
@@ -2238,7 +2254,7 @@ Tab::~Tab ()
}
/*
- * groupCreateSlot
+ * Tab::Tab
*
*/
Tab::Tab (Group *group, CompWindow *w) :
@@ -2249,13 +2265,9 @@ Tab::Tab (Group *group, CompWindow *w) :
msSinceLastMove (0)
{
GROUP_WINDOW (w);
-
- if (group->tabBar)
- {
- group->tabBar->insertTab (this);
- gw->tab = this;
- gw->updateProperty ();
- }
+
+ gw->tab = this;
+ gw->updateProperty ();
}
#define SPRING_K gs->optionGetDragSpringK()
@@ -2425,7 +2437,7 @@ TabBar::applyForces (Tab *draggedSlot)
rightSpeed += rightForce;
}
- foreach (tab, tabs)
+ foreach (tab, *this)
{
centerX = (tab->region.boundingRect ().x1 () +
tab->region.boundingRect ().x2 ()) / 2;
@@ -2446,12 +2458,12 @@ TabBar::applyForces (Tab *draggedSlot)
if (draggedSlotForce < 0)
{
- tabs.getPrevTab (tab, tab2);
+ getPrevTab (tab, tab2);
leftSpeed += draggedSlotForce;
}
else if (draggedSlotForce > 0)
{
- tabs.getNextTab (tab, tab2);
+ getNextTab (tab, tab2);
rightSpeed += draggedSlotForce;
}
@@ -2462,10 +2474,10 @@ TabBar::applyForces (Tab *draggedSlot)
if (tab2 != draggedSlot)
tab2->speed += draggedSlotForce;
- if (!tabs.getPrevTab (tab2, prevTab2))
+ if (!getPrevTab (tab2, prevTab2))
prevTab2 = NULL;
- if (!tabs.getNextTab (tab2, nextTab2))
+ if (!getNextTab (tab2, nextTab2))
nextTab2 = NULL;
tab2 = (draggedSlotForce < 0) ? prevTab2 : nextTab2;
@@ -2473,7 +2485,7 @@ TabBar::applyForces (Tab *draggedSlot)
}
}
- foreach (Tab *tab, tabs)
+ foreach (Tab *tab, *this)
{
groupApplyFriction (&tab->speed);
groupApplySpeedLimit (&tab->speed);
@@ -2495,7 +2507,7 @@ TabBar::applySpeeds (int msSinceLastRepaint)
{
int move;
CompRect box;
- Bool updateTabBar = FALSE;
+ bool updateTabBar = false;
GROUP_SCREEN (screen);
@@ -2516,7 +2528,7 @@ TabBar::applySpeeds (int msSinceLastRepaint)
box.setWidth (box.width () - move);
leftMsSinceLastMove = 0;
- updateTabBar = TRUE;
+ updateTabBar = true;
}
else if (leftSpeed == 0 &&
region.boundingRect ().x1 () != leftSpringX &&
@@ -2530,7 +2542,7 @@ TabBar::applySpeeds (int msSinceLastRepaint)
region.boundingRect ().x1 ());
leftMsSinceLastMove = 0;
- updateTabBar = TRUE;
+ updateTabBar = true;
}
else if (leftSpeed == 0)
leftMsSinceLastMove = 0;
@@ -2542,7 +2554,7 @@ TabBar::applySpeeds (int msSinceLastRepaint)
box.setWidth (box.width () + move);
rightMsSinceLastMove = 0;
- updateTabBar = TRUE;
+ updateTabBar = true;
}
else if (rightSpeed == 0 &&
region.boundingRect ().x2 () != rightSpringX &&
@@ -2555,15 +2567,15 @@ TabBar::applySpeeds (int msSinceLastRepaint)
region.boundingRect ().x1 ());
leftMsSinceLastMove = 0;
- updateTabBar = TRUE;
+ updateTabBar = true;
}
else if (rightSpeed == 0)
rightMsSinceLastMove = 0;
if (updateTabBar)
- resizeRegion (box, FALSE);
+ resizeRegion (box, false);
- foreach (Tab *tab, tabs)
+ foreach (Tab *tab, *this)
{
int slotCenter;
diff --git a/src/window.cpp b/src/window.cpp
index d2a11df..f754d48 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -28,6 +28,9 @@
/*
* GroupWindow::checkProperty
+ *
+ * Description: Checks our set window property on startup - groups windows
+ * according to those properties
*
*/
bool
@@ -52,23 +55,25 @@ GroupWindow::checkProperty (long int &id,
if (type == XA_CARDINAL && fmt == 32 && nitems == 5)
{
id = data[0];
- tabbed = (Bool) data[1];
+ tabbed = (bool) data[1];
color[0] = (GLushort) data[2];
color[1] = (GLushort) data[3];
color[2] = (GLushort) data[4];
XFree (data);
- return TRUE;
+ return true;
}
else if (fmt != 0)
XFree (data);
}
- return FALSE;
+ return false;
}
/*
- * groupUpdateWindowProperty
+ * GroupWindow::updateProperty
+ *
+ * On color change / group change / tabbing - update the X Window property
*
*/
void
@@ -85,7 +90,7 @@ GroupWindow::updateProperty ()
long int buffer[5];
buffer[0] = group->identifier;
- buffer[1] = (tab) ? TRUE : FALSE;
+ buffer[1] = (tab) ? true : false;
/* group color RGB */
buffer[2] = group->color[0];
@@ -400,7 +405,7 @@ GroupWindow::moveNotify (int dx,
int dy,
bool immediate)
{
- Bool viewportChange;
+ bool viewportChange;
GLTexture::Matrix mat;
GROUP_SCREEN (screen);
@@ -440,7 +445,7 @@ GroupWindow::moveNotify (int dx,
group->tabBar->moveRegion (dx, dy, true);
- foreach (Tab *tab, group->tabBar->tabs)
+ foreach (Tab *tab, *group->tabBar)
{
tab->region.translate (dx, dy);
tab->springX += dx;
@@ -450,13 +455,12 @@ GroupWindow::moveNotify (int dx,
/* Do not enqueue windows if:
* - we have not specified to move all windows
- * -
- * -
+ * - windows are currently being tabbed into or out of a group
* - the grabed window is not grabbed for moving */
if ((!gs->optionGetMoveAll () || gs->ignoreMode) ||
(group->tabBar && group->tabBar->tabbingState != TabBar::NoTabbing) ||
- (group->grabWindow != window->id () || /* XXX: implement this */
+ (group->grabWindow != window->id () ||
!(group->grabMask & CompWindowGrabMoveMask)))
{
return;
@@ -472,12 +476,12 @@ GroupWindow::moveNotify (int dx,
if (cw->state () & MAXIMIZE_STATE)
{
if (viewportChange)
- gs->enqueueMoveNotify (cw, dx, dy, immediate, TRUE);
+ gs->enqueueMoveNotify (cw, dx, dy, immediate, true);
}
else if (!viewportChange)
{
- needsPosSync = TRUE;
- gs->enqueueMoveNotify (cw, dx, dy, immediate, TRUE);
+ needsPosSync = true;
+ gs->enqueueMoveNotify (cw, dx, dy, immediate, true);
}
}
}
@@ -504,7 +508,7 @@ GroupWindow::grabNotify (int x,
if (group && !gs->ignoreMode && !gs->queued)
{
- Bool doResizeAll;
+ bool doResizeAll;
doResizeAll = gs->optionGetResizeAll () &&
(mask & CompWindowGrabResizeMask);
@@ -611,7 +615,7 @@ GroupWindow::ungrabNotify ()
gw->resizeGeometry.setWidth (WIN_WIDTH (cw));
gw->resizeGeometry.setHeight (WIN_HEIGHT (cw));
- mask = gw->updateResizeRectangle (rect, FALSE);
+ mask = gw->updateResizeRectangle (rect, false);
if (mask)
{
XWindowChanges xwc;
@@ -635,7 +639,7 @@ GroupWindow::ungrabNotify ()
if (gw->needsPosSync)
{
cw->syncPosition ();
- gw->needsPosSync = FALSE;
+ gw->needsPosSync = false;
}
@@ -659,7 +663,15 @@ GroupWindow::ungrabNotify ()
window->ungrabNotify ();
}
-/* getOutputExtents */
+/*
+ * GroupWindow::getOutputExents
+ *
+ * Description: Our glow is painted outside the window texture (see
+ * addWindowGeometry. This wrapped function overrides the current output
+ * extents (w->output and w->outputRect) to include to glow, such that it
+ * will be damaged correctly by other plugins
+ *
+ */
void
GroupWindow::getOutputExtents (CompWindowExtents &output)
{
@@ -687,7 +699,11 @@ GroupWindow::getOutputExtents (CompWindowExtents &output)
}
}
-/* activateWindow */
+/* GroupWindow::activate ()
+ *
+ * Change tab on a window activation
+ *
+ */
void
GroupWindow::activate ()
{
@@ -721,7 +737,7 @@ GroupWindow::deleteGroupWindow ()
if (gs->draggedSlot && gs->dragged &&
gs->draggedSlot->window->id () == window->id ())
{
- group->tabBar->unhookTab (tab, FALSE);
+ group->tabBar->unhookTab (tab, false);
}
else
{
@@ -753,7 +769,7 @@ GroupWindow::deleteGroupWindow ()
back onscreen, so we do that here */
CompWindow *lw = group->windows.front ();
- GroupWindow::get (lw)->setVisibility (TRUE);
+ GroupWindow::get (lw)->setVisibility (true);
}
if (!gs->optionGetAutotabCreate ())
@@ -823,9 +839,9 @@ GroupWindow::removeFromGroup ()
/* Although when there is no top-tab, it will never really
animate anything, if we don't start the animation,
the window will never get removed. */
- group->startTabbingAnimation (FALSE);
+ group->startTabbingAnimation (false);
- GroupWindow::get (window)->setVisibility (TRUE);
+ GroupWindow::get (window)->setVisibility (true);
group->ungroupState = Group::UngroupSingle;
animateState |= IS_UNGROUPING;
}
@@ -834,7 +850,7 @@ GroupWindow::removeFromGroup ()
/* no tab bar - delete immediately */
deleteGroupWindow ();
- if (GroupScreen::get (screen)->optionGetAutotabCreate () && is ())
+ if (GroupScreen::get (screen)->optionGetAutotabCreate () && isGroupable ())
{
Selection sel;
@@ -850,6 +866,17 @@ GroupWindow::removeFromGroup ()
/*
* GroupWindow::glPaint ()
*
+ * Description: Adjust window paint parameters. We need to account for animations
+ * such as tab into / untab and rotation between tabs. This uses
+ * some booleans to determine where to enter:
+ *
+ * doRotate: we should rotate this window as it is being tabbed
+ * doTabbing: this window is being tabbed into / out of a group
+ * showTabbar: we should draw the Tab Bar on this window texture
+ * inSelection: we should dim this window to show it is being selected for
+ * grouping
+ * !resizeGeometry.isEmpty () : we should stretch this window because it is
+ * being resized with its group
*/
bool
@@ -858,8 +885,8 @@ GroupWindow::glPaint (const GLWindowPaintAttrib &attrib,
const CompRegion &region,
unsigned int mask)
{
- Bool status;
- Bool doRotate, doTabbing, showTabbar;
+ bool status;
+ bool doRotate, doTabbing, showTabbar;
GROUP_SCREEN (screen);
@@ -886,9 +913,9 @@ GroupWindow::glPaint (const GLWindowPaintAttrib &attrib,
}
else
{
- doRotate = FALSE;
- doTabbing = FALSE;
- showTabbar = FALSE;
+ doRotate = false;
+ doTabbing = false;
+ showTabbar = false;
}
if (windowHideInfo)
@@ -1076,6 +1103,8 @@ GroupWindow::glPaint (const GLWindowPaintAttrib &attrib,
/*
* GroupWindow::glDraw
*
+ * This adds the Glow geometry and paints it
+ *
*/
bool
GroupWindow::glDraw (const GLMatrix &transform,
@@ -1166,13 +1195,21 @@ GroupWindow::glDraw (const GLMatrix &transform,
}
-/* XXX: should use new wrappable functions */
+/*
+ * GroupWindow::damageRect ()
+ *
+ * Description: Applies window damage / updates
+ *
+ * If initial is true and we should auto-tab, then automatically create
+ * a window group and tab it
+ *
+ */
bool
GroupWindow::damageRect (bool initial,
const CompRect &rect)
{
- Bool status;
+ bool status;
GROUP_SCREEN (screen);
@@ -1180,7 +1217,7 @@ GroupWindow::damageRect (bool initial,
if (initial)
{
- if (gs->optionGetAutotabCreate () && is ())
+ if (gs->optionGetAutotabCreate () && isGroupable ())
{
if (!group && (windowState == WindowNormal))
{
@@ -1227,67 +1264,26 @@ GroupWindow::damageRect (bool initial,
/*
- * GroupWindow::is ()
+ * GroupWindow::isGroupable ()
+ *
+ * Description: Should we group this window
*
*/
bool
-GroupWindow::is ()
+GroupWindow::isGroupable ()
{
if (window->overrideRedirect ())
- return FALSE;
+ return false;
if (window->type () & CompWindowTypeDesktopMask)
- return FALSE;
+ return false;
if (window->invisible ())
- return FALSE;
+ return false;
if (!GroupScreen::get (screen)->optionGetWindowMatch ().evaluate (window))
- return FALSE;
+ return false;
- return TRUE;
-}
-
-/*
- * GroupWindow::inRegion ()
- *
- */
-
-bool
-GroupWindow::inRegion (CompRegion reg,
- float precision)
-{
- CompRegion buf;
- int area = 0;
-
- buf = reg.intersected (window->region ());
-
- /* buf area */
- area = buf.boundingRect ().width () * buf.boundingRect ().height ();
-
- if (area >= WIN_WIDTH (window) * WIN_HEIGHT (window) * precision)
- {
- return true;
- }
-
- return false;
-}
-
-void
-GroupWindow::select ()
-{
- GROUP_SCREEN (screen);
-
- if (!inSelection)
- {
- gs->masterSelection.push_back (window);
- selection = &gs->masterSelection;
- }
- else
- {
- selection = NULL;
- gs->masterSelection.remove (window);
- }
- inSelection = !inSelection;
+ return true;
}