summaryrefslogtreecommitdiffstats
path: root/twin/workspace.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'twin/workspace.cpp')
-rw-r--r--twin/workspace.cpp821
1 files changed, 477 insertions, 344 deletions
diff --git a/twin/workspace.cpp b/twin/workspace.cpp
index 8cddbb72e..23661e6a0 100644
--- a/twin/workspace.cpp
+++ b/twin/workspace.cpp
@@ -167,13 +167,8 @@ Workspace::Workspace( bool restore )
global_shortcuts_disabled_for_client( false ),
root (0),
workspaceInit (true),
- startup(0), electric_have_borders(false),
- electric_current_border(0),
- electric_top_border(None),
- electric_bottom_border(None),
- electric_left_border(None),
- electric_right_border(None),
- layoutOrientation(Qt::Vertical),
+ startup(0),
+ layoutOrientation(TQt::Vertical),
layoutX(-1),
layoutY(2),
workarea(NULL),
@@ -194,16 +189,22 @@ Workspace::Workspace( bool restore )
installed_colormap = default_colormap;
session.setAutoDelete( TRUE );
- connect( &temporaryRulesMessages, TQT_SIGNAL( gotMessage( const TQString& )),
- this, TQT_SLOT( gotTemporaryRulesMessage( const TQString& )));
- connect( &rulesUpdatedTimer, TQT_SIGNAL( timeout()), this, TQT_SLOT( writeWindowRules()));
+ for (int i = 0; i < ACTIVE_BORDER_COUNT; ++i)
+ {
+ active_reserved[i] = 0;
+ active_windows[i] = None;
+ }
+
+ connect( &temporaryRulesMessages, TQ_SIGNAL( gotMessage( const TQString& )),
+ this, TQ_SLOT( gotTemporaryRulesMessage( const TQString& )));
+ connect( &rulesUpdatedTimer, TQ_SIGNAL( timeout()), this, TQ_SLOT( writeWindowRules()));
updateXTime(); // needed for proper initialization of user_time in Client ctor
- delayFocusTimer = 0;
-
- electric_time_first = GET_QT_X_TIME();
- electric_time_last = GET_QT_X_TIME();
+ delayFocusTimer = 0;
+
+ active_time_first = get_tqt_x_time();
+ active_time_last = get_tqt_x_time();
if ( restore )
loadSessionInfo();
@@ -258,7 +259,7 @@ Workspace::Workspace( bool restore )
init();
#if (TQT_VERSION-0 >= 0x030200) // XRANDR support
- connect( kapp->desktop(), TQT_SIGNAL( resized( int )), TQT_SLOT( desktopResized()));
+ connect( kapp->desktop(), TQ_SIGNAL( resized( int )), TQ_SLOT( desktopResized()));
#endif
if (!supportsCompMgr()) {
@@ -273,7 +274,7 @@ Workspace::Workspace( bool restore )
if (options->useTranslucency)
{
kompmgr = new TDEProcess;
- connect(kompmgr, TQT_SIGNAL(receivedStderr(TDEProcess*, char*, int)), TQT_SLOT(handleKompmgrOutput(TDEProcess*, char*, int)));
+ connect(kompmgr, TQ_SIGNAL(receivedStderr(TDEProcess*, char*, int)), TQ_SLOT(handleKompmgrOutput(TDEProcess*, char*, int)));
*kompmgr << TDE_COMPOSITOR_BINARY;
if (kompmgrpid)
{
@@ -304,13 +305,17 @@ Workspace::Workspace( bool restore )
void Workspace::init()
+{
+ if (options->activeBorders() == Options::ActiveSwitchAlways)
{
- checkElectricBorders();
+ reserveActiveBorderSwitching(true);
+ }
+ updateActiveBorders();
// not used yet
// topDock = 0L;
// maximizedWindowCounter = 0;
-
+
supportWindow = new TQWidget;
XLowerWindow( tqt_xdisplay(), supportWindow->winId()); // see usage in layers.cpp
@@ -422,15 +427,15 @@ void Workspace::init()
// now we know how many desktops we'll, thus, we initialise the positioning object
initPositioning = new Placement(this);
- connect(&reconfigureTimer, TQT_SIGNAL(timeout()), this,
- TQT_SLOT(slotReconfigure()));
- connect( &updateToolWindowsTimer, TQT_SIGNAL( timeout()), this, TQT_SLOT( slotUpdateToolWindows()));
+ connect(&reconfigureTimer, TQ_SIGNAL(timeout()), this,
+ TQ_SLOT(slotReconfigure()));
+ connect( &updateToolWindowsTimer, TQ_SIGNAL( timeout()), this, TQ_SLOT( slotUpdateToolWindows()));
- connect(kapp, TQT_SIGNAL(appearanceChanged()), this,
- TQT_SLOT(slotReconfigure()));
- connect(kapp, TQT_SIGNAL(settingsChanged(int)), this,
- TQT_SLOT(slotSettingsChanged(int)));
- connect(kapp, TQT_SIGNAL( kipcMessage( int, int )), this, TQT_SLOT( kipcMessage( int, int )));
+ connect(kapp, TQ_SIGNAL(appearanceChanged()), this,
+ TQ_SLOT(slotReconfigure()));
+ connect(kapp, TQ_SIGNAL(settingsChanged(int)), this,
+ TQ_SLOT(slotSettingsChanged(int)));
+ connect(kapp, TQ_SIGNAL( kipcMessage( int, int )), this, TQ_SLOT( kipcMessage( int, int )));
active_client = NULL;
rootInfo->setActiveWindow( None );
@@ -456,7 +461,7 @@ void Workspace::init()
unsigned int i, nwins;
Window root_return, parent_return, *wins;
XQueryTree(tqt_xdisplay(), root, &root_return, &parent_return, &wins, &nwins);
- for (i = 0; i < nwins; i++)
+ for (i = 0; i < nwins; i++)
{
XWindowAttributes attr;
XGetWindowAttributes(tqt_xdisplay(), wins[i], &attr);
@@ -464,12 +469,12 @@ void Workspace::init()
continue;
if( topmenu_space && topmenu_space->winId() == wins[ i ] )
continue;
- if (attr.map_state != IsUnmapped)
+ if (attr.map_state != IsUnmapped)
{
if ( addSystemTrayWin( wins[i] ) )
continue;
Client* c = createClient( wins[i], true );
- if ( c != NULL && root != tqt_xrootwin() )
+ if ( c != NULL && root != tqt_xrootwin() )
{ // TODO what is this?
// TODO may use TQWidget:.create
XReparentWindow( tqt_xdisplay(), c->frameId(), root, 0, 0 );
@@ -483,7 +488,6 @@ void Workspace::init()
updateStackingOrder( true );
updateClientArea();
- raiseElectricBorders();
// NETWM spec says we have to set it to (0,0) if we don't support it
NETPoint* viewports = new NETPoint[ number_of_desktops ];
@@ -514,12 +518,27 @@ void Workspace::init()
}
if( new_active_client != NULL )
activateClient( new_active_client );
+
+ // outline windows for active border maximize window mode
+ outline_left = XCreateWindow(tqt_xdisplay(), rootWin(), 0, 0, 1, 1, 0,
+ CopyFromParent, CopyFromParent, CopyFromParent,
+ CWOverrideRedirect, &attr);
+ outline_right = XCreateWindow(tqt_xdisplay(), rootWin(), 0, 0, 1, 1, 0,
+ CopyFromParent, CopyFromParent, CopyFromParent,
+ CWOverrideRedirect, &attr);
+ outline_top = XCreateWindow(tqt_xdisplay(), rootWin(), 0, 0, 1, 1, 0,
+ CopyFromParent, CopyFromParent, CopyFromParent,
+ CWOverrideRedirect, &attr);
+ outline_bottom = XCreateWindow(tqt_xdisplay(), rootWin(), 0, 0, 1, 1, 0,
+ CopyFromParent, CopyFromParent, CopyFromParent,
+ CWOverrideRedirect, &attr);
+
// SELI TODO this won't work with unreasonable focus policies,
// and maybe in rare cases also if the selected client doesn't
// want focus
workspaceInit = false;
// TODO ungrabXServer()
- }
+}
Workspace::~Workspace()
{
@@ -550,6 +569,12 @@ Workspace::~Workspace()
writeWindowRules();
TDEGlobal::config()->sync();
+ // destroy outline windows for active border maximize window mode
+ XDestroyWindow(tqt_xdisplay(), outline_left);
+ XDestroyWindow(tqt_xdisplay(), outline_right);
+ XDestroyWindow(tqt_xdisplay(), outline_top);
+ XDestroyWindow(tqt_xdisplay(), outline_bottom);
+
delete rootInfo;
delete supportWindow;
delete mgr;
@@ -785,7 +810,7 @@ void Workspace::updateFocusChains( Client* c, FocusChainChange change )
void Workspace::updateOverlappingShadows(unsigned long window)
{
Client *client;
-
+
if ((client = findClient(WindowMatchPredicate((WId)window))))
// Redraw overlapping shadows without waiting for the specified window
// to redraw its own shadow
@@ -795,7 +820,7 @@ void Workspace::updateOverlappingShadows(unsigned long window)
void Workspace::setShadowed(unsigned long window, bool shadowed)
{
Client *client;
-
+
if ((client = findClient(WindowMatchPredicate((WId)window))))
client->setShadowed(shadowed);
}
@@ -891,7 +916,7 @@ void Workspace::updateCurrentTopMenu()
}
// ... then hide the other ones. Avoids flickers.
- for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it)
+ for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it)
{
if( (*it)->isTopMenu() && (*it) != menubar )
(*it)->hideClient( true );
@@ -1008,7 +1033,7 @@ void Workspace::updateColormap()
Colormap cmap = default_colormap;
if ( activeClient() && activeClient()->colormap() != None )
cmap = activeClient()->colormap();
- if ( cmap != installed_colormap )
+ if ( cmap != installed_colormap )
{
XInstallColormap(tqt_xdisplay(), cmap );
installed_colormap = cmap;
@@ -1038,6 +1063,11 @@ void Workspace::slotReconfigure()
kdDebug(1212) << "Workspace::slotReconfigure()" << endl;
reconfigureTimer.stop();
+ if (options->activeBorders() == Options::ActiveSwitchAlways)
+ {
+ reserveActiveBorderSwitching(false);
+ }
+
TDEGlobal::config()->reparseConfiguration();
unsigned long changed = options->updateSettings();
tab_box->reconfigure();
@@ -1068,7 +1098,10 @@ void Workspace::slotReconfigure()
forEachClient( CheckBorderSizesProcedure());
}
- checkElectricBorders();
+ if (options->activeBorders() == Options::ActiveSwitchAlways)
+ {
+ reserveActiveBorderSwitching(true);
+ }
if( options->topMenuEnabled() && !managingTopMenus())
{
@@ -1155,10 +1188,10 @@ void Workspace::slotReconfigure()
if (!kompmgr)
{
kompmgr = new TDEProcess;
- connect(kompmgr, TQT_SIGNAL(receivedStderr(TDEProcess*, char*, int)), TQT_SLOT(handleKompmgrOutput(TDEProcess*, char*, int)));
+ connect(kompmgr, TQ_SIGNAL(receivedStderr(TDEProcess*, char*, int)), TQ_SLOT(handleKompmgrOutput(TDEProcess*, char*, int)));
*kompmgr << TDE_COMPOSITOR_BINARY;
}
- TQTimer::singleShot( 200, this, TQT_SLOT(startKompmgr()) ); // wait some time to ensure system's ready for restart
+ TQTimer::singleShot( 200, this, TQ_SLOT(startKompmgr()) ); // wait some time to ensure system's ready for restart
}
}
else
@@ -1195,7 +1228,7 @@ void Workspace::loadDesktopSettings()
desktop_focus_chain.resize( n );
// make it +1, so that it can be accessed as [1..numberofdesktops]
focus_chain.resize( n + 1 );
- for(int i = 1; i <= n; i++)
+ for(int i = 1; i <= n; i++)
{
TQString s = c->readEntry(TQString("Name_%1").arg(i),
i18n("Desktop %1").arg(i));
@@ -1215,21 +1248,21 @@ void Workspace::saveDesktopSettings()
TDEConfigGroupSaver saver(c,groupname);
c->writeEntry("Number", number_of_desktops );
- for(int i = 1; i <= number_of_desktops; i++)
+ for(int i = 1; i <= number_of_desktops; i++)
{
TQString s = desktopName( i );
TQString defaultvalue = i18n("Desktop %1").arg(i);
- if ( s.isEmpty() )
+ if ( s.isEmpty() )
{
s = defaultvalue;
rootInfo->setDesktopName( i, s.utf8().data() );
}
- if (s != defaultvalue)
+ if (s != defaultvalue)
{
c->writeEntry( TQString("Name_%1").arg(i), s );
}
- else
+ else
{
TQString currentvalue = c->readEntry(TQString("Name_%1").arg(i));
if (currentvalue != defaultvalue)
@@ -1267,10 +1300,10 @@ void Workspace::doNotManage( TQString title )
*/
bool Workspace::isNotManaged( const TQString& title )
{
- for ( TQStringList::Iterator it = doNotManageList.begin(); it != doNotManageList.end(); ++it )
+ for ( TQStringList::Iterator it = doNotManageList.begin(); it != doNotManageList.end(); ++it )
{
TQRegExp r( (*it) );
- if (r.search(title) != -1)
+ if (r.search(title) != -1)
{
doNotManageList.remove( it );
return TRUE;
@@ -1282,7 +1315,7 @@ bool Workspace::isNotManaged( const TQString& title )
/*!
Refreshes all the client windows
*/
-void Workspace::refresh()
+void Workspace::refresh()
{
TQWidget w;
w.setGeometry( TQApplication::desktop()->geometry() );
@@ -1319,7 +1352,7 @@ void ObscuringWindows::create( Client* c )
Window obs_win;
XWindowChanges chngs;
int mask = CWSibling | CWStackMode;
- if( cached->count() > 0 )
+ if( cached->count() > 0 )
{
cached->remove( obs_win = cached->first());
chngs.x = c->x();
@@ -1328,7 +1361,7 @@ void ObscuringWindows::create( Client* c )
chngs.height = c->height();
mask |= CWX | CWY | CWWidth | CWHeight;
}
- else
+ else
{
XSetWindowAttributes a;
a.background_pixmap = None;
@@ -1349,7 +1382,7 @@ ObscuringWindows::~ObscuringWindows()
max_cache_size = TQMAX( max_cache_size, obscuring_windows.count() + 4 ) - 1;
for( TQValueList<Window>::ConstIterator it = obscuring_windows.begin();
it != obscuring_windows.end();
- ++it )
+ ++it )
{
XUnmapWindow( tqt_xdisplay(), *it );
if( cached->count() < max_cache_size )
@@ -1377,7 +1410,7 @@ bool Workspace::setCurrentDesktop( int new_desktop )
StackingUpdatesBlocker blocker( this );
int old_desktop = current_desktop;
- if (new_desktop != current_desktop)
+ if (new_desktop != current_desktop)
{
++block_showing_desktop;
/*
@@ -1416,7 +1449,7 @@ bool Workspace::setCurrentDesktop( int new_desktop )
}
if (desktopHasCompositing) {
- // If composition is in use then we cannot hide the old windows before showing the new ones,
+ // If composition is in use then we cannot hide the old windows before showing the new ones,
// unless you happen to like the "flicker annoyingly to desktop" effect... :-P
XSync( tqt_xdisplay(), false); // Make absolutely certain all new windows are shown before hiding the old ones
for ( ClientList::ConstIterator it = stacking_order.begin(); it != stacking_order.end(); ++it) {
@@ -1439,7 +1472,7 @@ bool Workspace::setCurrentDesktop( int new_desktop )
--block_focus;
Client* c = 0;
- if ( options->focusPolicyIsReasonable())
+ if ( options->focusPolicyIsReasonable())
{
// Search in focus chain
if ( movingClient != NULL && active_client == movingClient
@@ -1448,7 +1481,7 @@ bool Workspace::setCurrentDesktop( int new_desktop )
{
c = active_client; // the requestFocus below will fail, as the client is already active
}
- if ( !c )
+ if ( !c )
{
for( ClientList::ConstIterator it = focus_chain[currentDesktop()].fromLast();
it != focus_chain[currentDesktop()].end();
@@ -1475,9 +1508,9 @@ bool Workspace::setCurrentDesktop( int new_desktop )
if( c != active_client )
setActiveClient( NULL, Allowed );
- if ( c )
+ if ( c )
requestFocus( c );
- else
+ else
focusToNull();
updateCurrentTopMenu();
@@ -1520,10 +1553,10 @@ int Workspace::desktopToRight( int desktop ) const
int x,y;
calcDesktopLayout(x,y);
int dt = desktop-1;
- if (layoutOrientation == Qt::Vertical)
+ if (layoutOrientation == TQt::Vertical)
{
dt += y;
- if ( dt >= numberOfDesktops() )
+ if ( dt >= numberOfDesktops() )
{
if ( options->rollOverDesktops )
dt -= numberOfDesktops();
@@ -1534,7 +1567,7 @@ int Workspace::desktopToRight( int desktop ) const
else
{
int d = (dt % x) + 1;
- if ( d >= x )
+ if ( d >= x )
{
if ( options->rollOverDesktops )
d -= x;
@@ -1551,10 +1584,10 @@ int Workspace::desktopToLeft( int desktop ) const
int x,y;
calcDesktopLayout(x,y);
int dt = desktop-1;
- if (layoutOrientation == Qt::Vertical)
+ if (layoutOrientation == TQt::Vertical)
{
dt -= y;
- if ( dt < 0 )
+ if ( dt < 0 )
{
if ( options->rollOverDesktops )
dt += numberOfDesktops();
@@ -1565,7 +1598,7 @@ int Workspace::desktopToLeft( int desktop ) const
else
{
int d = (dt % x) - 1;
- if ( d < 0 )
+ if ( d < 0 )
{
if ( options->rollOverDesktops )
d += x;
@@ -1582,10 +1615,10 @@ int Workspace::desktopUp( int desktop ) const
int x,y;
calcDesktopLayout(x,y);
int dt = desktop-1;
- if (layoutOrientation == Qt::Horizontal)
+ if (layoutOrientation == TQt::Horizontal)
{
dt -= x;
- if ( dt < 0 )
+ if ( dt < 0 )
{
if ( options->rollOverDesktops )
dt += numberOfDesktops();
@@ -1596,7 +1629,7 @@ int Workspace::desktopUp( int desktop ) const
else
{
int d = (dt % y) - 1;
- if ( d < 0 )
+ if ( d < 0 )
{
if ( options->rollOverDesktops )
d += y;
@@ -1613,10 +1646,10 @@ int Workspace::desktopDown( int desktop ) const
int x,y;
calcDesktopLayout(x,y);
int dt = desktop-1;
- if (layoutOrientation == Qt::Horizontal)
+ if (layoutOrientation == TQt::Horizontal)
{
dt += x;
- if ( dt >= numberOfDesktops() )
+ if ( dt >= numberOfDesktops() )
{
if ( options->rollOverDesktops )
dt -= numberOfDesktops();
@@ -1627,7 +1660,7 @@ int Workspace::desktopDown( int desktop ) const
else
{
int d = (dt % y) + 1;
- if ( d >= y )
+ if ( d >= y )
{
if ( options->rollOverDesktops )
d -= y;
@@ -1655,7 +1688,7 @@ void Workspace::setNumberOfDesktops( int n )
// if increasing the number, do the resizing now,
// otherwise after the moving of windows to still existing desktops
- if( old_number_of_desktops < number_of_desktops )
+ if( old_number_of_desktops < number_of_desktops )
{
rootInfo->setNumberOfDesktops( number_of_desktops );
NETPoint* viewports = new NETPoint[ number_of_desktops ];
@@ -1667,17 +1700,17 @@ void Workspace::setNumberOfDesktops( int n )
// if the number of desktops decreased, move all
// windows that would be hidden to the last visible desktop
- if( old_number_of_desktops > number_of_desktops )
+ if( old_number_of_desktops > number_of_desktops )
{
for( ClientList::ConstIterator it = clients.begin();
it != clients.end();
- ++it)
+ ++it)
{
if( !(*it)->isOnAllDesktops() && (*it)->desktop() > numberOfDesktops())
sendClientToDesktop( *it, numberOfDesktops(), true );
}
}
- if( old_number_of_desktops > number_of_desktops )
+ if( old_number_of_desktops > number_of_desktops )
{
rootInfo->setNumberOfDesktops( number_of_desktops );
NETPoint* viewports = new NETPoint[ number_of_desktops ];
@@ -1717,7 +1750,7 @@ void Workspace::sendClientToDesktop( Client* c, int desk, bool dont_activate )
else
restackClientUnderActive( c );
}
- else
+ else
{
raiseClient( c );
}
@@ -1813,7 +1846,7 @@ void Workspace::updateDesktopLayout()
{
// rootInfo->desktopLayoutCorner(); // I don't find this worth bothering, feel free to
layoutOrientation = ( rootInfo->desktopLayoutOrientation() == NET::OrientationHorizontal
- ? Qt::Horizontal : Qt::Vertical );
+ ? TQt::Horizontal : TQt::Vertical );
layoutX = rootInfo->desktopLayoutColumnsRows().width();
layoutY = rootInfo->desktopLayoutColumnsRows().height();
if( layoutX == 0 && layoutY == 0 ) // not given, set default layout
@@ -1904,7 +1937,7 @@ void Workspace::propagateSystemTrayWins()
Window *cl = new Window[ systemTrayWins.count()];
int i = 0;
- for ( SystemTrayWindowList::ConstIterator it = systemTrayWins.begin(); it != systemTrayWins.end(); ++it )
+ for ( SystemTrayWindowList::ConstIterator it = systemTrayWins.begin(); it != systemTrayWins.end(); ++it )
{
cl[i++] = (*it).win;
}
@@ -1920,7 +1953,7 @@ void Workspace::killWindowId( Window window_to_kill )
return;
Window window = window_to_kill;
Client* client = NULL;
- for(;;)
+ for(;;)
{
client = findClient( FrameIdMatchPredicate( window ));
if( client != NULL ) // found the client
@@ -2053,12 +2086,12 @@ void Workspace::sendTakeActivity( Client* c, Time timestamp, long flags )
*/
void Workspace::slotGrabWindow()
{
- if ( active_client )
+ if ( active_client )
{
TQPixmap snapshot = TQPixmap::grabWindow( active_client->frameId() );
//No XShape - no work.
- if( Shape::available())
+ if( Shape::available())
{
//As the first step, get the mask from XShape.
int count, order;
@@ -2068,7 +2101,7 @@ void Workspace::slotGrabWindow()
//ShapeBounding - ShapeClipping is defined to be the border.
//Since the border area is part of the window, we use bounding
// to limit our work region
- if (rects)
+ if (rects)
{
//Create a TQRegion from the rectangles describing the bounding mask.
TQRegion contents;
@@ -2087,9 +2120,9 @@ void Workspace::slotGrabWindow()
//Construct a bitmap mask from the rectangles
TQBitmap mask( snapshot.width(), snapshot.height());
TQPainter p(&mask);
- p.fillRect(0, 0, mask.width(), mask.height(), Qt::color1);
+ p.fillRect(0, 0, mask.width(), mask.height(), TQt::color1);
for (uint pos = 0; pos < maskedAwayRects.count(); pos++)
- p.fillRect(maskedAwayRects[pos], Qt::color0);
+ p.fillRect(maskedAwayRects[pos], TQt::color0);
p.end();
snapshot.setMask(mask);
}
@@ -2119,9 +2152,9 @@ void Workspace::slotGrabDesktop()
void Workspace::slotMouseEmulation()
{
- if ( mouse_emulation )
+ if ( mouse_emulation )
{
- XUngrabKeyboard(tqt_xdisplay(), GET_QT_X_TIME());
+ XUngrabKeyboard(tqt_xdisplay(), get_tqt_x_time());
mouse_emulation = FALSE;
return;
}
@@ -2129,7 +2162,7 @@ void Workspace::slotMouseEmulation()
if ( XGrabKeyboard(tqt_xdisplay(),
root, FALSE,
GrabModeAsync, GrabModeAsync,
- GET_QT_X_TIME()) == GrabSuccess )
+ get_tqt_x_time()) == GrabSuccess )
{
mouse_emulation = TRUE;
mouse_emulation_state = 0;
@@ -2151,7 +2184,7 @@ WId Workspace::getMouseEmulationWindow()
uint state;
Window w;
Client * c = 0;
- do
+ do
{
w = child;
if (!c)
@@ -2173,19 +2206,19 @@ unsigned int Workspace::sendFakedMouseEvent( TQPoint pos, WId w, MouseEmulation
if ( !w )
return state;
TQWidget* widget = TQWidget::find( w );
- if ( (!widget || widget->inherits(TQTOOLBUTTON_OBJECT_NAME_STRING) ) && !findClient( WindowMatchPredicate( w )) )
+ if ( (!widget || widget->inherits("TQToolButton") ) && !findClient( WindowMatchPredicate( w )) )
{
int x, y;
Window xw;
XTranslateCoordinates( tqt_xdisplay(), tqt_xrootwin(), w, pos.x(), pos.y(), &x, &y, &xw );
- if ( type == EmuMove )
+ if ( type == EmuMove )
{ // motion notify events
XEvent e;
e.type = MotionNotify;
e.xmotion.window = w;
e.xmotion.root = tqt_xrootwin();
e.xmotion.subwindow = w;
- e.xmotion.time = GET_QT_X_TIME();
+ e.xmotion.time = get_tqt_x_time();
e.xmotion.x = x;
e.xmotion.y = y;
e.xmotion.x_root = pos.x();
@@ -2194,14 +2227,14 @@ unsigned int Workspace::sendFakedMouseEvent( TQPoint pos, WId w, MouseEmulation
e.xmotion.is_hint = NotifyNormal;
XSendEvent( tqt_xdisplay(), w, TRUE, ButtonMotionMask, &e );
}
- else
+ else
{
XEvent e;
e.type = type == EmuRelease ? ButtonRelease : ButtonPress;
e.xbutton.window = w;
e.xbutton.root = tqt_xrootwin();
e.xbutton.subwindow = w;
- e.xbutton.time = GET_QT_X_TIME();
+ e.xbutton.time = get_tqt_x_time();
e.xbutton.x = x;
e.xbutton.y = y;
e.xbutton.x_root = pos.x();
@@ -2210,9 +2243,9 @@ unsigned int Workspace::sendFakedMouseEvent( TQPoint pos, WId w, MouseEmulation
e.xbutton.button = button;
XSendEvent( tqt_xdisplay(), w, TRUE, ButtonPressMask, &e );
- if ( type == EmuPress )
+ if ( type == EmuPress )
{
- switch ( button )
+ switch ( button )
{
case 2:
state |= Button2Mask;
@@ -2225,9 +2258,9 @@ unsigned int Workspace::sendFakedMouseEvent( TQPoint pos, WId w, MouseEmulation
break;
}
}
- else
+ else
{
- switch ( button )
+ switch ( button )
{
case 2:
state &= ~Button2Mask;
@@ -2261,7 +2294,7 @@ bool Workspace::keyPressMouseEmulation( XKeyEvent& ev )
int delta = is_control?1:is_alt?32:8;
TQPoint pos = TQCursor::pos();
- switch ( kc )
+ switch ( kc )
{
case XK_Left:
case XK_KP_Left:
@@ -2306,16 +2339,16 @@ bool Workspace::keyPressMouseEmulation( XKeyEvent& ev )
case XK_Return:
case XK_space:
case XK_KP_Enter:
- case XK_KP_Space:
+ case XK_KP_Space:
{
- if ( !mouse_emulation_state )
+ if ( !mouse_emulation_state )
{
// nothing was pressed, fake a LMB click
mouse_emulation_window = getMouseEmulationWindow();
mouse_emulation_state = sendFakedMouseEvent( pos, mouse_emulation_window, EmuPress, Button1, mouse_emulation_state );
mouse_emulation_state = sendFakedMouseEvent( pos, mouse_emulation_window, EmuRelease, Button1, mouse_emulation_state );
}
- else
+ else
{ // release all
if ( mouse_emulation_state & Button1Mask )
mouse_emulation_state = sendFakedMouseEvent( pos, mouse_emulation_window, EmuRelease, Button1, mouse_emulation_state );
@@ -2327,7 +2360,7 @@ bool Workspace::keyPressMouseEmulation( XKeyEvent& ev )
}
// fall through
case XK_Escape:
- XUngrabKeyboard(tqt_xdisplay(), GET_QT_X_TIME());
+ XUngrabKeyboard(tqt_xdisplay(), get_tqt_x_time());
mouse_emulation = FALSE;
return TRUE;
default:
@@ -2357,292 +2390,393 @@ void Workspace::delayFocus()
requestFocus( delayfocus_client );
cancelDelayFocus();
}
-
+
void Workspace::requestDelayFocus( Client* c )
{
delayfocus_client = c;
delete delayFocusTimer;
delayFocusTimer = new TQTimer( this );
- connect( delayFocusTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( delayFocus() ) );
+ connect( delayFocusTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( delayFocus() ) );
delayFocusTimer->start( options->delayFocusInterval, TRUE );
}
-
+
void Workspace::cancelDelayFocus()
{
delete delayFocusTimer;
delayFocusTimer = 0;
}
-// Electric Borders
-//========================================================================//
-// Electric Border Window management. Electric borders allow a user
-// to change the virtual desktop by moving the mouse pointer to the
-// borders. Technically this is done with input only windows. Since
-// electric borders can be switched on and off, we have these two
-// functions to create and destroy them.
-void Workspace::checkElectricBorders( bool force )
+/* Active (Electric) Borders
+ * ========================================================================
+ * Active Border Window management. Active borders allow a user to switch
+ * to another virtual desktop or activate other features by moving
+ * the mouse pointer to the borders or corners of the workspace.
+ * Technically this is done with input only windows.
+ */
+void Workspace::updateActiveBorders()
{
- if( force )
- destroyBorderWindows();
-
- electric_current_border = 0;
-
+ active_time_first = get_tqt_x_time();
+ active_time_last = get_tqt_x_time();
+ active_time_last_trigger = get_tqt_x_time();
+ active_current_border = ActiveNone;
TQRect r = TQApplication::desktop()->geometry();
- electricTop = r.top();
- electricBottom = r.bottom();
- electricLeft = r.left();
- electricRight = r.right();
+ activeTop = r.top();
+ activeBottom = r.bottom();
+ activeLeft = r.left();
+ activeRight = r.right();
- if (options->electricBorders() == Options::ElectricAlways)
- createBorderWindows();
- else
- destroyBorderWindows();
+ for (int pos = 0; pos < ACTIVE_BORDER_COUNT; ++pos)
+ {
+ if (active_reserved[pos] == 0)
+ {
+ if (active_windows[pos] != None)
+ {
+ XDestroyWindow( tqt_xdisplay(), active_windows[pos] );
+ }
+ active_windows[pos] = None;
+ continue;
+ }
+
+ if (active_windows[pos] != None)
+ {
+ continue;
+ }
+
+ XSetWindowAttributes attributes;
+ attributes.override_redirect = True;
+ attributes.event_mask = EnterWindowMask;
+ unsigned long valuemask = CWOverrideRedirect | CWEventMask;
+ int xywh[ ACTIVE_BORDER_COUNT ][ 4 ] =
+ {
+ { r.left() + 1, r.top(), r.width() - 2, 1 }, // top
+ { r.right(), r.top(), 1, 1 }, // topright
+ { r.right(), r.top() + 1, 1, r.height() - 2 }, // etc.
+ { r.right(), r.bottom(), 1, 1 },
+ { r.left() + 1, r.bottom(), r.width() - 2, 1 },
+ { r.left(), r.bottom(), 1, 1 },
+ { r.left(), r.top() + 1, 1, r.height() - 2 },
+ { r.left(), r.top(), 1, 1 }
+ };
+ active_windows[pos] = XCreateWindow(tqt_xdisplay(), tqt_xrootwin(),
+ xywh[pos][0], xywh[pos][1],
+ xywh[pos][2], xywh[pos][3],
+ 0, CopyFromParent, InputOnly,
+ CopyFromParent, valuemask,
+ &attributes);
+ XMapWindow(tqt_xdisplay(), active_windows[pos]);
+
+ // Set XdndAware on the windows, so that DND enter events are received (#86998)
+ Atom version = 4; // XDND version
+ XChangeProperty(tqt_xdisplay(), active_windows[pos],
+ atoms->xdnd_aware, XA_ATOM, 32, PropModeReplace,
+ (unsigned char*)&version, 1);
}
+}
-void Workspace::createBorderWindows()
+void Workspace::destroyActiveBorders()
+{
+ for (int pos = 0; pos < ACTIVE_BORDER_COUNT; ++pos)
+ {
+ if (active_windows[ pos ] != None)
+ {
+ XDestroyWindow( tqt_xdisplay(), active_windows[ pos ] );
+ }
+ active_windows[ pos ] = None;
+ }
+}
+
+void Workspace::reserveActiveBorderSwitching( bool reserve )
+{
+ for (int pos = 0; pos < ACTIVE_BORDER_COUNT; ++pos)
{
- if ( electric_have_borders )
+ if (reserve)
+ {
+ reserveActiveBorder(static_cast<ActiveBorder>(pos));
+ }
+ else
+ {
+ unreserveActiveBorder(static_cast<ActiveBorder>(pos));
+ }
+ }
+}
+
+void Workspace::reserveActiveBorder( ActiveBorder border )
+{
+ if (border == ActiveNone)
return;
- electric_have_borders = true;
+ if (active_reserved[border]++ == 0)
+ TQTimer::singleShot(0, this, TQ_SLOT(updateActiveBorders()));
+}
- TQRect r = TQApplication::desktop()->geometry();
- XSetWindowAttributes attributes;
- unsigned long valuemask;
- attributes.override_redirect = True;
- attributes.event_mask = ( EnterWindowMask | LeaveWindowMask );
- valuemask= (CWOverrideRedirect | CWEventMask | CWCursor );
- attributes.cursor = XCreateFontCursor(tqt_xdisplay(),
- XC_sb_up_arrow);
- electric_top_border = XCreateWindow (tqt_xdisplay(), tqt_xrootwin(),
- 0,0,
- r.width(),1,
- 0,
- CopyFromParent, InputOnly,
- CopyFromParent,
- valuemask, &attributes);
- XMapWindow(tqt_xdisplay(), electric_top_border);
-
- attributes.cursor = XCreateFontCursor(tqt_xdisplay(),
- XC_sb_down_arrow);
- electric_bottom_border = XCreateWindow (tqt_xdisplay(), tqt_xrootwin(),
- 0,r.height()-1,
- r.width(),1,
- 0,
- CopyFromParent, InputOnly,
- CopyFromParent,
- valuemask, &attributes);
- XMapWindow(tqt_xdisplay(), electric_bottom_border);
-
- attributes.cursor = XCreateFontCursor(tqt_xdisplay(),
- XC_sb_left_arrow);
- electric_left_border = XCreateWindow (tqt_xdisplay(), tqt_xrootwin(),
- 0,0,
- 1,r.height(),
- 0,
- CopyFromParent, InputOnly,
- CopyFromParent,
- valuemask, &attributes);
- XMapWindow(tqt_xdisplay(), electric_left_border);
-
- attributes.cursor = XCreateFontCursor(tqt_xdisplay(),
- XC_sb_right_arrow);
- electric_right_border = XCreateWindow (tqt_xdisplay(), tqt_xrootwin(),
- r.width()-1,0,
- 1,r.height(),
- 0,
- CopyFromParent, InputOnly,
- CopyFromParent,
- valuemask, &attributes);
- XMapWindow(tqt_xdisplay(), electric_right_border);
- // Set XdndAware on the windows, so that DND enter events are received (#86998)
- Atom version = 4; // XDND version
- XChangeProperty( tqt_xdisplay(), electric_top_border, atoms->xdnd_aware, XA_ATOM,
- 32, PropModeReplace, ( unsigned char* )&version, 1 );
- XChangeProperty( tqt_xdisplay(), electric_bottom_border, atoms->xdnd_aware, XA_ATOM,
- 32, PropModeReplace, ( unsigned char* )&version, 1 );
- XChangeProperty( tqt_xdisplay(), electric_left_border, atoms->xdnd_aware, XA_ATOM,
- 32, PropModeReplace, ( unsigned char* )&version, 1 );
- XChangeProperty( tqt_xdisplay(), electric_right_border, atoms->xdnd_aware, XA_ATOM,
- 32, PropModeReplace, ( unsigned char* )&version, 1 );
- }
-
-
-// Electric Border Window management. Electric borders allow a user
-// to change the virtual desktop by moving the mouse pointer to the
-// borders. Technically this is done with input only windows. Since
-// electric borders can be switched on and off, we have these two
-// functions to create and destroy them.
-void Workspace::destroyBorderWindows()
- {
- if( !electric_have_borders)
- return;
+void Workspace::unreserveActiveBorder( ActiveBorder border )
+{
+ if (border == ActiveNone)
+ return;
- electric_have_borders = false;
+ assert(active_reserved[ border ] > 0);
+ if (--active_reserved[ border ] == 0)
+ TQTimer::singleShot(0, this, TQ_SLOT(updateActiveBorders()));
+}
- if(electric_top_border)
- XDestroyWindow(tqt_xdisplay(),electric_top_border);
- if(electric_bottom_border)
- XDestroyWindow(tqt_xdisplay(),electric_bottom_border);
- if(electric_left_border)
- XDestroyWindow(tqt_xdisplay(),electric_left_border);
- if(electric_right_border)
- XDestroyWindow(tqt_xdisplay(),electric_right_border);
+void Workspace::checkActiveBorder(const TQPoint &pos, Time now)
+{
+ Time treshold_set = options->activeBorderDelay(); // set timeout
+ Time treshold_trigger = 250; // Minimum time between triggers
+ Time treshold_reset = 250; // reset timeout
+ int activation_distance = options->borderActivationDistance();
- electric_top_border = None;
- electric_bottom_border = None;
- electric_left_border = None;
- electric_right_border = None;
+ bool have_borders = false;
+ for (int i = 0; i < ACTIVE_BORDER_COUNT; ++i)
+ {
+ if (active_windows[ i ] != None)
+ {
+ have_borders = true;
+ }
}
+ if (!have_borders) {
+ return;
+ }
+
+ // Mouse should not move more than this many pixels
+ int distance_reset = activation_distance + 10;
-void Workspace::clientMoved(const TQPoint &pos, Time now)
+ // Leave active maximizing mode when window moved away
+ if (active_current_border != ActiveNone &&
+ (pos.x() > activeLeft + distance_reset) &&
+ (pos.x() < activeRight - distance_reset) &&
+ (pos.y() > activeTop + distance_reset) &&
+ (pos.y() < activeBottom - distance_reset))
{
- if (options->electricBorders() == Options::ElectricDisabled)
- return;
+ if (movingClient &&
+ (options->activeBorders() == Options::ActiveTileMaximize ||
+ options->activeBorders() == Options::ActiveTileOnly))
+ {
+ movingClient->cancelActiveBorderMaximizing();
+ return;
+ }
+ }
+
+ // These checks take activation distance into account, creating a
+ // virtual "activation band" for easier border/corner activation.
+ bool active_left = pos.x() < activeLeft + activation_distance;
+ bool active_right = pos.x() > activeRight - activation_distance;
+ bool active_top = pos.y() < activeTop + activation_distance;
+ bool active_bottom = pos.y() > activeBottom - activation_distance;
- if ((pos.x() != electricLeft) &&
- (pos.x() != electricRight) &&
- (pos.y() != electricTop) &&
- (pos.y() != electricBottom))
+ if (!active_left && !active_right && !active_top && !active_bottom)
return;
- Time treshold_set = options->electricBorderDelay(); // set timeout
- Time treshold_reset = 250; // reset timeout
- int distance_reset = 30; // Mouse should not move more than this many pixels
+ // These checks are used to make corner activation easier: we assume
+ // a 25% zone on the edge of each border where instead of half size
+ // tiling we perform quarter size tiling. The rest 50% is left for
+ // normal half size tiling.
+ // These options make sense only for the tiling mode.
+ int active_width_quart = (activeRight - activeLeft) / 4;
+ int active_height_quart = (activeBottom - activeTop) / 4;
- int border = 0;
- if (pos.x() == electricLeft)
- border = 1;
- else if (pos.x() == electricRight)
- border = 2;
- else if (pos.y() == electricTop)
- border = 3;
- else if (pos.y() == electricBottom)
- border = 4;
+ bool active_qleft = false;
+ bool active_qright = false;
+ bool active_qtop = false;
+ bool active_qbottom = false;
+ if (options->activeBorders() == Options::ActiveTileMaximize ||
+ options->activeBorders() == Options::ActiveTileOnly)
+ {
+ active_qleft = pos.x() < activeLeft + active_width_quart;
+ active_qright = pos.x() > activeRight - active_width_quart;
+ active_qtop = pos.y() < activeTop + active_height_quart;
+ active_qbottom = pos.y() > activeBottom - active_height_quart;
+ }
- if ((electric_current_border == border) &&
- (timestampDiff(electric_time_last, now) < treshold_reset) &&
- ((pos-electric_push_point).manhattanLength() < distance_reset))
- {
- electric_time_last = now;
+ ActiveBorder border = ActiveNone;
+ if ((active_left && active_qtop) || (active_top && active_qleft))
+ {
+ border = ActiveTopLeft;
+ }
+ else if ((active_right && active_qtop) || (active_top && active_qright))
+ {
+ border = ActiveTopRight;
+ }
+ else if ((active_left && active_qbottom) || (active_bottom && active_qleft))
+ {
+ border = ActiveBottomLeft;
+ }
+ else if ((active_right && active_qbottom) || (active_bottom && active_qright))
+ {
+ border = ActiveBottomRight;
+ }
+ else if (active_left)
+ {
+ border = ActiveLeft;
+ }
+ else if (active_right)
+ {
+ border = ActiveRight;
+ }
+ else if (active_top)
+ {
+ border = ActiveTop;
+ }
+ else if (active_bottom)
+ {
+ border = ActiveBottom;
+ }
+ else
+ {
+ // Should never happen
+ abort();
+ }
- if (timestampDiff(electric_time_first, now) > treshold_set)
- {
- electric_current_border = 0;
+ if( active_windows[border] == None )
+ {
+ return;
+ }
- TQRect r = TQApplication::desktop()->geometry();
- int offset;
+ if ((active_current_border == border) &&
+ (timestampDiff(active_time_last, now) < treshold_reset) &&
+ (timestampDiff(active_time_last_trigger, now) > treshold_trigger) &&
+ ((pos-active_push_point).manhattanLength() < distance_reset))
+ {
+ active_time_last = now;
+ if (timestampDiff(active_time_first, now) > treshold_set)
+ {
+ active_time_last_trigger = now;
+ active_current_border = ActiveNone;
+ bool isSide = (border == ActiveTop || border == ActiveRight ||
+ border == ActiveBottom || border == ActiveLeft);
- int desk_before = currentDesktop();
- switch(border)
+ if (movingClient)
+ {
+ // Desktop switching
+ if (options->activeBorders() == Options::ActiveSwitchAlways ||
+ options->activeBorders() == Options::ActiveSwitchOnMove)
{
- case 1:
- slotSwitchDesktopLeft();
- if (currentDesktop() != desk_before)
- {
- offset = r.width() / 5;
- TQCursor::setPos(r.width() - offset, pos.y());
- }
- break;
+ activeBorderSwitchDesktop(border, pos);
+ return; // Don't reset cursor position
+ }
- case 2:
- slotSwitchDesktopRight();
- if (currentDesktop() != desk_before)
- {
- offset = r.width() / 5;
- TQCursor::setPos(offset, pos.y());
- }
- break;
+ // Tiling maximize
+ else if (options->activeBorders() == Options::ActiveTileMaximize &&
+ border == ActiveTop && movingClient->isMaximizable())
+ {
+ if (!movingClient->isResizable()) return;
+ movingClient->setActiveBorderMode(ActiveMaximizeMode);
+ movingClient->setActiveBorder(ActiveNone);
+ movingClient->setActiveBorderMaximizing(true);
+ }
- case 3:
- slotSwitchDesktopUp();
- if (currentDesktop() != desk_before)
- {
- offset = r.height() / 5;
- TQCursor::setPos(pos.x(), r.height() - offset);
- }
- break;
+ // Tiling
+ else if ((options->activeBorders() == Options::ActiveTileMaximize ||
+ options->activeBorders() == Options::ActiveTileOnly))
+ {
+ if (!movingClient->isResizable()) return;
+ movingClient->setActiveBorderMode(ActiveTilingMode);
+ movingClient->setActiveBorder(border);
+ movingClient->setActiveBorderMaximizing(true);
+ }
- case 4:
- slotSwitchDesktopDown();
- if (currentDesktop() != desk_before)
- {
- offset = r.height() / 5;
- TQCursor::setPos(pos.x(), offset);
- }
- break;
+ else
+ {
+ return; // Don't reset cursor position
+ }
+ }
+ else
+ {
+ // Desktop switching
+ if (options->activeBorders() == Options::ActiveSwitchAlways && isSide)
+ {
+ activeBorderSwitchDesktop(border, pos);
+ return; // Don't reset cursor position
}
- return;
}
}
- else
- {
- electric_current_border = border;
- electric_time_first = now;
- electric_time_last = now;
- electric_push_point = pos;
- }
+ }
+ else
+ {
+ active_current_border = border;
+ active_time_first = now;
+ active_time_last = now;
+ active_push_point = pos;
+ }
- int mouse_warp = 1;
+ if ((options->activeBorders() == Options::ActiveSwitchAlways && !movingClient) ||
+ activation_distance < 2)
+ {
+ // Reset the pointer to find out whether the user is really pushing
+ // (ordered according to enum ActiveBorder minus ActiveNone)
+ const int xdiff[ ACTIVE_BORDER_COUNT ] = { 0, -1, -1, -1, 0, 1, 1, 1 };
+ const int ydiff[ ACTIVE_BORDER_COUNT ] = { 1, 1, 0, -1, -1, -1, 0, 1 };
+ TQCursor::setPos(pos.x() + xdiff[border], pos.y() + ydiff[border]);
+ }
+}
- // reset the pointer to find out wether the user is really pushing
- switch( border)
- {
- case 1: TQCursor::setPos(pos.x()+mouse_warp, pos.y()); break;
- case 2: TQCursor::setPos(pos.x()-mouse_warp, pos.y()); break;
- case 3: TQCursor::setPos(pos.x(), pos.y()+mouse_warp); break;
- case 4: TQCursor::setPos(pos.x(), pos.y()-mouse_warp); break;
- }
+void Workspace::activeBorderSwitchDesktop(ActiveBorder border, const TQPoint& _pos)
+{
+ TQPoint pos = _pos;
+ TQRect r = TQApplication::desktop()->geometry();
+ const int offset = 5;
+
+ int desk_before = currentDesktop();
+ if (border == ActiveLeft || border == ActiveTopLeft || border == ActiveBottomLeft)
+ {
+ slotSwitchDesktopLeft();
+ pos.setX(r.width() - offset);
+ }
+ if (border == ActiveRight || border == ActiveTopRight || border == ActiveBottomRight)
+ {
+ slotSwitchDesktopRight();
+ pos.setX(offset);
}
-// this function is called when the user entered an electric border
+ if (border == ActiveTop || border == ActiveTopLeft || border == ActiveTopRight)
+ {
+ slotSwitchDesktopUp();
+ pos.setY(r.height() - offset);
+ }
+ if (border == ActiveBottom || border == ActiveBottomLeft || border == ActiveBottomRight)
+ {
+ slotSwitchDesktopDown();
+ pos.setY(offset);
+ }
+
+ if (currentDesktop() != desk_before)
+ {
+ TQCursor::setPos(pos);
+ }
+}
+
+// this function is called when the user entered an active border
// with the mouse. It may switch to another virtual desktop
-bool Workspace::electricBorder(XEvent *e)
+bool Workspace::activeBorderEvent(XEvent *e)
+{
+ if (e->type == EnterNotify)
{
- if( !electric_have_borders )
- return false;
- if( e->type == EnterNotify )
- {
- if( e->xcrossing.window == electric_top_border ||
- e->xcrossing.window == electric_left_border ||
- e->xcrossing.window == electric_bottom_border ||
- e->xcrossing.window == electric_right_border)
- // the user entered an electric border
- {
- clientMoved( TQPoint( e->xcrossing.x_root, e->xcrossing.y_root ), e->xcrossing.time );
- return true;
- }
- }
- if( e->type == ClientMessage )
+ for (int i = 0; i < ACTIVE_BORDER_COUNT; ++i)
{
- if( e->xclient.message_type == atoms->xdnd_position
- && ( e->xclient.window == electric_top_border
- || e->xclient.window == electric_bottom_border
- || e->xclient.window == electric_left_border
- || e->xclient.window == electric_right_border ))
- {
- updateXTime();
- clientMoved( TQPoint( e->xclient.data.l[2]>>16, e->xclient.data.l[2]&0xffff), GET_QT_X_TIME() );
- return true;
+ if (active_windows[i] != None && e->xcrossing.window == active_windows[i])
+ { // the user entered an active border
+ checkActiveBorder(TQPoint(e->xcrossing.x_root, e->xcrossing.y_root), e->xcrossing.time);
+ return true;
}
}
- return false;
}
-
-// electric borders (input only windows) have to be always on the
-// top. For that reason kwm calls this function always after some
-// windows have been raised.
-void Workspace::raiseElectricBorders()
+ if (e->type == ClientMessage)
{
-
- if(electric_have_borders)
+ if (e->xclient.message_type == atoms->xdnd_position)
{
- XRaiseWindow(tqt_xdisplay(), electric_top_border);
- XRaiseWindow(tqt_xdisplay(), electric_left_border);
- XRaiseWindow(tqt_xdisplay(), electric_bottom_border);
- XRaiseWindow(tqt_xdisplay(), electric_right_border);
+ for (int i = 0; i < ACTIVE_BORDER_COUNT; ++i)
+ {
+ if (active_windows[i] != None && e->xclient.window == active_windows[i])
+ {
+ updateXTime();
+ checkActiveBorder(TQPoint(e->xclient.data.l[2]>>16, e->xclient.data.l[2]&0xffff), get_tqt_x_time());
+ return true;
+ }
+ }
}
}
+ return false;
+}
void Workspace::addTopMenu( Client* c )
{
@@ -2678,12 +2812,12 @@ void Workspace::lostTopMenuSelection()
{
// kdDebug() << "lost TopMenu selection" << endl;
// make sure this signal is always set when not owning the selection
- disconnect( topmenu_watcher, TQT_SIGNAL( lostOwner()), this, TQT_SLOT( lostTopMenuOwner()));
- connect( topmenu_watcher, TQT_SIGNAL( lostOwner()), this, TQT_SLOT( lostTopMenuOwner()));
+ disconnect( topmenu_watcher, TQ_SIGNAL( lostOwner()), this, TQ_SLOT( lostTopMenuOwner()));
+ connect( topmenu_watcher, TQ_SIGNAL( lostOwner()), this, TQ_SLOT( lostTopMenuOwner()));
if( !managing_topmenus )
return;
- connect( topmenu_watcher, TQT_SIGNAL( lostOwner()), this, TQT_SLOT( lostTopMenuOwner()));
- disconnect( topmenu_selection, TQT_SIGNAL( lostOwnership()), this, TQT_SLOT( lostTopMenuSelection()));
+ connect( topmenu_watcher, TQ_SIGNAL( lostOwner()), this, TQ_SLOT( lostTopMenuOwner()));
+ disconnect( topmenu_selection, TQ_SIGNAL( lostOwnership()), this, TQ_SLOT( lostTopMenuSelection()));
managing_topmenus = false;
delete topmenu_space;
topmenu_space = NULL;
@@ -2712,8 +2846,8 @@ void Workspace::setupTopMenuHandling()
{
if( managing_topmenus )
return;
- connect( topmenu_selection, TQT_SIGNAL( lostOwnership()), this, TQT_SLOT( lostTopMenuSelection()));
- disconnect( topmenu_watcher, TQT_SIGNAL( lostOwner()), this, TQT_SLOT( lostTopMenuOwner()));
+ connect( topmenu_selection, TQ_SIGNAL( lostOwnership()), this, TQ_SLOT( lostTopMenuSelection()));
+ disconnect( topmenu_watcher, TQ_SIGNAL( lostOwner()), this, TQ_SLOT( lostTopMenuOwner()));
managing_topmenus = true;
topmenu_space = new TQWidget;
Window stack[ 2 ];
@@ -2758,7 +2892,7 @@ bool Workspace::checkStartupNotification( Window w, TDEStartupInfoId& id, TDESta
*/
void Workspace::focusToNull()
{
- XSetInputFocus(tqt_xdisplay(), null_focus_window, RevertToPointerRoot, GET_QT_X_TIME() );
+ XSetInputFocus(tqt_xdisplay(), null_focus_window, RevertToPointerRoot, get_tqt_x_time() );
}
void Workspace::helperDialog( const TQString& message, const Client* c )
@@ -2824,7 +2958,7 @@ void Workspace::startKompmgr()
}
else {
// Try again a bit later!
- TQTimer::singleShot( 200, this, TQT_SLOT(startKompmgr()) );
+ TQTimer::singleShot( 200, this, TQ_SLOT(startKompmgr()) );
return;
}
pid_t kompmgrpid = getCompositorPID();
@@ -2852,12 +2986,12 @@ void Workspace::startKompmgr()
char selection_name[ 100 ];
sprintf( selection_name, "_NET_WM_CM_S%d", DefaultScreen( tqt_xdisplay()));
kompmgr_selection = new TDESelectionOwner( selection_name );
- connect( kompmgr_selection, TQT_SIGNAL( lostOwnership()), TQT_SLOT( stopKompmgr()));
+ connect( kompmgr_selection, TQ_SIGNAL( lostOwnership()), TQ_SLOT( stopKompmgr()));
kompmgr_selection->claim( true );
- connect(kompmgr, TQT_SIGNAL(processExited(TDEProcess*)), TQT_SLOT(restartKompmgr(TDEProcess*)));
+ connect(kompmgr, TQ_SIGNAL(processExited(TDEProcess*)), TQ_SLOT(restartKompmgr(TDEProcess*)));
options->useTranslucency = TRUE;
//allowKompmgrRestart = FALSE;
- //TQTimer::singleShot( 60000, this, TQT_SLOT(unblockKompmgrRestart()) );
+ //TQTimer::singleShot( 60000, this, TQ_SLOT(unblockKompmgrRestart()) );
TQByteArray ba;
TQDataStream arg(ba, IO_WriteOnly);
arg << "";
@@ -2873,7 +3007,7 @@ void Workspace::stopKompmgr()
}
delete kompmgr_selection;
kompmgr_selection = NULL;
- kompmgr->disconnect(this, TQT_SLOT(restartKompmgr(TDEProcess*)));
+ kompmgr->disconnect(this, TQ_SLOT(restartKompmgr(TDEProcess*)));
options->useTranslucency = FALSE;
if (popup){ delete popup; popup = 0L; } // to add/remove opacity slider
kompmgr->kill(SIGKILL);
@@ -2902,7 +3036,7 @@ void Workspace::unblockKompmgrRestart()
}
void Workspace::restartKompmgr( TDEProcess *proc )
-// this is for inernal purpose (crashhandling) only, usually you want to use workspace->stopKompmgr(); TQTimer::singleShot(200, workspace, TQT_SLOT(startKompmgr()));
+// this is for inernal purpose (crashhandling) only, usually you want to use workspace->stopKompmgr(); TQTimer::singleShot(200, workspace, TQ_SLOT(startKompmgr()));
{
bool crashed;
if (proc->signalled()) { // looks like kompmgr may have crashed
@@ -2951,7 +3085,7 @@ void Workspace::restartKompmgr( TDEProcess *proc )
else
{
allowKompmgrRestart = FALSE;
- TQTimer::singleShot( 60000, this, TQT_SLOT(unblockKompmgrRestart()) );
+ TQTimer::singleShot( 60000, this, TQ_SLOT(unblockKompmgrRestart()) );
}
}
}
@@ -2978,7 +3112,7 @@ void Workspace::handleKompmgrOutput( TDEProcess* , char *buffer, int buflen)
else return; //skip others
// kompmgr startup failed or succeeded, release connection
kompmgr->closeStderr();
- disconnect(kompmgr, TQT_SIGNAL(receivedStderr(TDEProcess*, char*, int)), this, TQT_SLOT(handleKompmgrOutput(TDEProcess*, char*, int)));
+ disconnect(kompmgr, TQ_SIGNAL(receivedStderr(TDEProcess*, char*, int)), this, TQ_SLOT(handleKompmgrOutput(TDEProcess*, char*, int)));
if( !message.isEmpty())
{
TDEProcess proc;
@@ -2988,8 +3122,7 @@ void Workspace::handleKompmgrOutput( TDEProcess* , char *buffer, int buflen)
proc.start(TDEProcess::DontCare);
}
}
-
-
+
void Workspace::setOpacity(unsigned long winId, unsigned int opacityPercent)
{
if (opacityPercent > 100) opacityPercent = 100;