diff options
author | Mavridis Philippe <[email protected]> | 2023-07-09 17:01:04 +0300 |
---|---|---|
committer | Mavridis Philippe <[email protected]> | 2023-07-10 12:10:54 +0300 |
commit | bb44b9863c49c05e5d2d761e65981853ed42adcd (patch) | |
tree | 14222a2223926bd98b908ca8286c7dcb2289fca3 | |
parent | 84c43976446c4694049cc6439e961b718bc84fca (diff) | |
download | tdebase-bb44b9863c49c05e5d2d761e65981853ed42adcd.tar.gz tdebase-bb44b9863c49c05e5d2d761e65981853ed42adcd.zip |
twin: Minor code cleanup and refactoring
Refactoring concerns active border code.
Signed-off-by: Mavridis Philippe <[email protected]>
(cherry picked from commit 0339423ced3db53f9155c6c174d9508517358f9c)
-rw-r--r-- | twin/client.cpp | 76 | ||||
-rw-r--r-- | twin/client.h | 8 | ||||
-rw-r--r-- | twin/events.cpp | 54 | ||||
-rw-r--r-- | twin/geometry.cpp | 10 | ||||
-rw-r--r-- | twin/kcmtwin/twinoptions/windows.cpp | 12 | ||||
-rw-r--r-- | twin/kcmtwin/twinoptions/windows.h | 4 | ||||
-rw-r--r-- | twin/layers.cpp | 8 | ||||
-rw-r--r-- | twin/utils.h | 31 | ||||
-rw-r--r-- | twin/workspace.cpp | 205 | ||||
-rw-r--r-- | twin/workspace.h | 14 |
10 files changed, 205 insertions, 217 deletions
diff --git a/twin/client.cpp b/twin/client.cpp index 484290e45..8c303ec15 100644 --- a/twin/client.cpp +++ b/twin/client.cpp @@ -178,7 +178,7 @@ Client::Client( Workspace *ws ) max_mode = MaximizeRestore; maxmode_restore = MaximizeRestore; - + cmap = None; frame_geometry = TQRect( 0, 0, 100, 100 ); // so that decorations don't start with size being (0,0) @@ -262,7 +262,7 @@ void Client::releaseWindow( bool on_shutdown ) { // Make sure it's not mapped if the app unmapped it (#65279). The app // may do map+unmap before we initially map the window by calling rawShow() from manage(). - XUnmapWindow( tqt_xdisplay(), client ); + XUnmapWindow( tqt_xdisplay(), client ); } client = None; XDestroyWindow( tqt_xdisplay(), wrapper ); @@ -526,7 +526,7 @@ bool Client::isModalSystemNotification() const void Client::updateShape() { // workaround for #19644 - shaped windows shouldn't have decoration - if( shape() && !noBorder()) + if( shape() && !noBorder()) { noborder = true; updateDecoration( true ); @@ -605,7 +605,7 @@ TQRegion Client::mask() const return TQRegion( 0, 0, width(), height()); return _mask; } - + void Client::setShapable(bool b) { long tmp = b?1:0; @@ -747,12 +747,12 @@ void Client::animateMinimizeOrUnminimize( bool minimize ) TQPixmap pm = animationPixmap( minimize ? width() : icongeom.width() ); TQRect before, after; - if ( minimize ) + if ( minimize ) { before = TQRect( x(), y(), width(), pm.height() ); after = TQRect( icongeom.x(), icongeom.y(), icongeom.width(), pm.height() ); } - else + else { before = TQRect( icongeom.x(), icongeom.y(), icongeom.width(), pm.height() ); after = TQRect( x(), y(), width(), pm.height() ); @@ -776,14 +776,14 @@ void Client::animateMinimizeOrUnminimize( bool minimize ) TQPainter p ( workspace()->desktopWidget() ); bool need_to_clear = FALSE; TQPixmap pm3; - do + do { if (area2 != area) { pm = animationPixmap( area.width() ); pm2 = TQPixmap::grabWindow( tqt_xrootwin(), area.x(), area.y(), area.width(), area.height() ); p.drawPixmap( area.x(), area.y(), pm ); - if ( need_to_clear ) + if ( need_to_clear ) { p.drawPixmap( area2.x(), area2.y(), pm3 ); need_to_clear = FALSE; @@ -799,11 +799,11 @@ void Client::animateMinimizeOrUnminimize( bool minimize ) area.setRight(before.right() + int(diff*rf)); area.setTop(before.top() + int(diff*tf)); area.setBottom(before.bottom() + int(diff*bf)); - if (area2 != area ) + if (area2 != area ) { if ( area2.intersects( area ) ) p.drawPixmap( area2.x(), area2.y(), pm2 ); - else + else { // no overlap, we can clear later to avoid flicker pm3 = pm2; need_to_clear = TRUE; @@ -877,7 +877,7 @@ void Client::setShade( ShadeMode mode ) int as = options->animateShade? 10 : 1; // TODO all this unmapping, resizing etc. feels too much duplicated from elsewhere - if ( isShade()) + if ( isShade()) { // shade_mode == ShadeNormal // we're about to shade, texx xcompmgr to prepare long _shade = 1; @@ -891,13 +891,13 @@ void Client::setShade( ShadeMode mode ) XUnmapWindow( tqt_xdisplay(), wrapper ); XUnmapWindow( tqt_xdisplay(), client ); XSelectInput( tqt_xdisplay(), wrapper, ClientWinMask | SubstructureNotifyMask ); - //as we hid the unmap event, xcompmgr didn't recognize the client wid has vanished, so we'll extra inform it + //as we hid the unmap event, xcompmgr didn't recognize the client wid has vanished, so we'll extra inform it //done xcompmgr workaround // FRAME repaint( FALSE ); // bool wasStaticContents = testWFlags( WStaticContents ); // setWFlags( WStaticContents ); int step = TQMAX( 4, QABS( h - s.height() ) / as )+1; - do + do { h -= step; XResizeWindow( tqt_xdisplay(), frameId(), s.width(), h ); @@ -917,9 +917,9 @@ void Client::setShade( ShadeMode mode ) } // tell xcompmgr shade's done _shade = 2; - XChangeProperty(tqt_xdisplay(), frameId(), atoms->net_wm_window_shade, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &_shade, 1L); + XChangeProperty(tqt_xdisplay(), frameId(), atoms->net_wm_window_shade, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &_shade, 1L); } - else + else { int h = height(); shade_geometry_change = true; @@ -927,7 +927,7 @@ void Client::setShade( ShadeMode mode ) // FRAME bool wasStaticContents = testWFlags( WStaticContents ); // setWFlags( WStaticContents ); int step = TQMAX( 4, QABS( h - s.height() ) / as )+1; - do + do { h += step; XResizeWindow( tqt_xdisplay(), frameId(), s.width(), h ); @@ -1733,14 +1733,14 @@ void Client::closeWindow() if( !isCloseable()) return; // Update user time, because the window may create a confirming dialog. - updateUserTime(); + updateUserTime(); if ( Pdeletewindow ) { Notify::raise( Notify::Close ); sendClientMessage( window(), atoms->wm_protocols, atoms->wm_delete_window); pingWindow(); } - else + else { // client will not react on wm_delete_window. We have not choice // but destroy his connection to the XServer. @@ -2267,7 +2267,7 @@ bool Client::providesContextHelp() const */ void Client::showContextHelp() { - if ( Pcontexthelp ) + if ( Pcontexthelp ) { sendClientMessage(window(), atoms->wm_protocols, atoms->net_wm_context_help); TQWhatsThis::enterWhatsThisMode(); // SELI? @@ -2286,17 +2286,17 @@ void Client::fetchName() TQString Client::readName() const { - if ( info->name() && info->name()[ 0 ] != '\0' ) + if ( info->name() && info->name()[ 0 ] != '\0' ) return TQString::fromUtf8( info->name() ); - else + else return KWin::readNameProperty( window(), XA_WM_NAME ); } - + KWIN_COMPARE_PREDICATE( FetchNameInternalPredicate, const Client*, (!cl->isSpecialWindow() || cl->isToolbar()) && cl != value && cl->caption() == value->caption()); void Client::setCaption( const TQString& s, bool force ) { - if ( s != cap_normal || force ) + if ( s != cap_normal || force ) { bool reset_name = force; for( unsigned int i = 0; @@ -2311,10 +2311,10 @@ void Client::setCaption( const TQString& s, bool force ) machine_suffix = " <@" + wmClientMachine( true ) + ">"; TQString shortcut_suffix = !shortcut().isNull() ? ( " {" + shortcut().toString() + "}" ) : ""; cap_suffix = machine_suffix + shortcut_suffix; - if ( ( !isSpecialWindow() || isToolbar()) && workspace()->findClient( FetchNameInternalPredicate( this ))) + if ( ( !isSpecialWindow() || isToolbar()) && workspace()->findClient( FetchNameInternalPredicate( this ))) { int i = 2; - do + do { cap_suffix = machine_suffix + " <" + TQString::number(i) + ">" + shortcut_suffix; i++; @@ -2344,11 +2344,11 @@ void Client::updateCaption() void Client::fetchIconicName() { TQString s; - if ( info->iconName() && info->iconName()[ 0 ] != '\0' ) + if ( info->iconName() && info->iconName()[ 0 ] != '\0' ) s = TQString::fromUtf8( info->iconName() ); - else + else s = KWin::readNameProperty( window(), XA_WM_ICON_NAME ); - if ( s != cap_iconic ) + if ( s != cap_iconic ) { bool was_set = !cap_iconic.isEmpty(); cap_iconic = s; @@ -2409,7 +2409,7 @@ void Client::getMotifHints() } void Client::readIcons( Window win, TQPixmap* icon, TQPixmap* miniicon ) - { + { // get the icons, allow scaling if( icon != NULL ) *icon = KWin::icon( win, 32, 32, TRUE, KWin::NETWM | KWin::WMHints ); @@ -2525,7 +2525,7 @@ Window Client::staticWmClientLeader(WId w) FALSE, XA_WINDOW, &type, &format, &nitems, &extra, &data ); XSetErrorHandler(oldHandler); - if (status == Success ) + if (status == Success ) { if (data && nitems > 0) result = *((Window*) data); @@ -2703,7 +2703,7 @@ void Client::setCursor( Position m ) { m = PositionCenter; } - switch ( m ) + switch ( m ) { case PositionTopLeft: case PositionBottomRight: @@ -2977,7 +2977,7 @@ void Client::updateOpacity() } } } - + void Client::updateShadowSize() // extra syncscreen flag allows to avoid double syncs when active state changes (as it will usually change for two windows) { @@ -2998,7 +2998,7 @@ uint Client::ruleOpacityActive() { return rule_opacity_active;// != 0; } - + bool Client::getWindowOpacity() //query translucency settings from X, returns true if window opacity is set { unsigned char *data = 0; @@ -3016,12 +3016,12 @@ bool Client::getWindowOpacity() //query translucency settings from X, returns tr } return FALSE; } - + void Client::setCustomOpacityFlag(bool custom) { custom_opacity = custom; } - + uint Client::opacity() { return opacity_; @@ -3031,7 +3031,7 @@ int Client::opacityPercentage() { return int(100*((double)opacity_/0xffffffff)); } - + bool Client::touches(const Client* c) // checks if this client borders c, needed to test beep media player window state { @@ -3045,7 +3045,7 @@ bool Client::touches(const Client* c) return TRUE; return FALSE; } - + void Client::setDecoHashProperty(uint topHeight, uint rightWidth, uint bottomHeight, uint leftWidth) { long data = (topHeight < 255 ? topHeight : 255) << 24 | @@ -3059,7 +3059,7 @@ void Client::unsetDecoHashProperty() { XDeleteProperty( tqt_xdisplay(), frameId(), atoms->net_wm_window_decohash); } - + #ifndef NDEBUG kdbgstream& operator<<( kdbgstream& stream, const Client* cl ) { diff --git a/twin/client.h b/twin/client.h index ae90fb619..302baaa62 100644 --- a/twin/client.h +++ b/twin/client.h @@ -455,7 +455,7 @@ class Client : public TQObject, public KDecorationDefines static void sendClientMessage( Window w, Atom a, Atom protocol, long data1 = 0, long data2 = 0, long data3 = 0 ); - void embedClient( Window w, const XWindowAttributes &attr ); + void embedClient( Window w, const XWindowAttributes &attr ); void detectNoBorder(); void detectShapable(); void destroyDecoration(); @@ -482,11 +482,11 @@ class Client : public TQObject, public KDecorationDefines bool move_faked_activity; Window move_resize_grab_window; bool unrestrictedMoveResize; - bool isMove() const + bool isMove() const { return moveResizeMode && mode == PositionCenter; } - bool isResize() const + bool isResize() const { return moveResizeMode && mode != PositionCenter; } @@ -959,7 +959,7 @@ inline bool Client::hasUserTimeSupport() const { return info->userTime() != -1U; } - + inline bool Client::ignoreFocusStealing() const { return ignore_focus_stealing; diff --git a/twin/events.cpp b/twin/events.cpp index 8430ad93a..d87b29e84 100644 --- a/twin/events.cpp +++ b/twin/events.cpp @@ -194,7 +194,7 @@ void RootInfo::changeShowingDesktop( bool showing ) */ bool Workspace::workspaceEvent( XEvent * e ) { - if ( mouse_emulation && (e->type == ButtonPress || e->type == ButtonRelease ) ) + if ( mouse_emulation && (e->type == ButtonPress || e->type == ButtonRelease ) ) { mouse_emulation = FALSE; XUngrabKeyboard( tqt_xdisplay(), GET_QT_X_TIME() ); @@ -211,7 +211,7 @@ bool Workspace::workspaceEvent( XEvent * e ) } // events that should be handled before Clients can get them - switch (e->type) + switch (e->type) { case ButtonPress: case ButtonRelease: @@ -284,7 +284,7 @@ bool Workspace::workspaceEvent( XEvent * e ) return true; } - switch (e->type) + switch (e->type) { case CreateNotify: if ( e->xcreatewindow.parent == root && @@ -303,7 +303,7 @@ bool Workspace::workspaceEvent( XEvent * e ) case UnmapNotify: { // check for system tray windows - if ( removeSystemTrayWin( e->xunmap.window, true ) ) + if ( removeSystemTrayWin( e->xunmap.window, true ) ) { // If the system tray gets destroyed, the system tray // icons automatically get unmapped, reparented and mapped @@ -317,7 +317,7 @@ bool Workspace::workspaceEvent( XEvent * e ) if ( XCheckTypedWindowEvent (tqt_xdisplay(), w, ReparentNotify, &ev) ) { - if ( ev.xreparent.parent != root ) + if ( ev.xreparent.parent != root ) { XReparentWindow( tqt_xdisplay(), w, root, 0, 0 ); addSystemTrayWin( w ); @@ -351,7 +351,7 @@ bool Workspace::workspaceEvent( XEvent * e ) // e->xmaprequest.window is different from e->xany.window // TODO this shouldn't be necessary now Client* c = findClient( WindowMatchPredicate( e->xmaprequest.window )); - if ( !c ) + if ( !c ) { // don't check for the parent being the root window, this breaks when some app unmaps // a window, changes something and immediately maps it back, without giving KWin @@ -364,7 +364,7 @@ bool Workspace::workspaceEvent( XEvent * e ) if ( addSystemTrayWin( e->xmaprequest.window ) ) return TRUE; c = createClient( e->xmaprequest.window, false ); - 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 ); @@ -405,7 +405,7 @@ bool Workspace::workspaceEvent( XEvent * e ) } case ConfigureRequest: { - if ( e->xconfigurerequest.parent == root ) + if ( e->xconfigurerequest.parent == root ) { XWindowChanges wc; wc.border_width = e->xconfigurerequest.border_width; @@ -542,7 +542,7 @@ bool Client::windowEvent( XEvent* e ) } // TODO move all focus handling stuff to separate file? - switch (e->type) + switch (e->type) { case UnmapNotify: unmapNotifyEvent( &e->xunmap ); @@ -800,7 +800,7 @@ void Client::configureRequestEvent( XConfigureRequestEvent* e ) return; } - if ( e->value_mask & CWBorderWidth ) + if ( e->value_mask & CWBorderWidth ) { // first, get rid of a window border XWindowChanges wc; @@ -836,7 +836,7 @@ void Client::propertyNotifyEvent( XPropertyEvent* e ) { if( e->window != window()) return; // ignore frame/wrapper - switch ( e->atom ) + switch ( e->atom ) { case XA_WM_NORMAL_HINTS: getWmNormalHints(); @@ -874,10 +874,10 @@ void Client::enterNotifyEvent( XCrossingEvent* e ) return; // care only about entering the whole frame if( e->mode == NotifyNormal || ( !options->focusPolicyIsReasonable() && - e->mode == NotifyUngrab ) ) + e->mode == NotifyUngrab ) ) { - if (options->shadeHover && isShade()) + if (options->shadeHover && isShade()) { delete shadeHoverTimer; shadeHoverTimer = new TQTimer( this ); @@ -890,7 +890,7 @@ void Client::enterNotifyEvent( XCrossingEvent* e ) if ( options->autoRaise && !isDesktop() && !isDock() && !isTopMenu() && workspace()->focusChangeEnabled() && - workspace()->topClientOnDesktop( workspace()->currentDesktop()) != this ) + workspace()->topClientOnDesktop( workspace()->currentDesktop()) != this ) { delete autoRaiseTimer; autoRaiseTimer = new TQTimer( this ); @@ -919,9 +919,9 @@ void Client::leaveNotifyEvent( XCrossingEvent* e ) { if( e->window != frameId()) return; // care only about leaving the whole frame - if ( e->mode == NotifyNormal ) + if ( e->mode == NotifyNormal ) { - if ( !buttonDown ) + if ( !buttonDown ) { mode = PositionCenter; setCursor( tqarrowCursor ); @@ -934,7 +934,7 @@ void Client::leaveNotifyEvent( XCrossingEvent* e ) // TODO this still sucks if a window appears above this one - it should lose the mouse // if this window is another client, but not if it's a popup ... maybe after KDE3.1 :( // (repeat after me 'AARGHL!') - if ( !lostMouse && e->detail != NotifyInferior ) + if ( !lostMouse && e->detail != NotifyInferior ) { int d1, d2, d3, d4; unsigned int d5; @@ -943,7 +943,7 @@ void Client::leaveNotifyEvent( XCrossingEvent* e ) || child == None ) lostMouse = true; // really lost the mouse } - if ( lostMouse ) + if ( lostMouse ) { cancelAutoRaise(); workspace()->cancelDelayFocus(); @@ -963,7 +963,7 @@ void Client::leaveNotifyEvent( XCrossingEvent* e ) #define XScrL KKeyNative::modXScrollLock() void Client::grabButton( int modifier ) { - unsigned int mods[ 8 ] = + unsigned int mods[ 8 ] = { 0, XCapL, XNumL, XNumL | XCapL, XScrL, XScrL | XCapL, @@ -980,7 +980,7 @@ void Client::grabButton( int modifier ) void Client::ungrabButton( int modifier ) { - unsigned int mods[ 8 ] = + unsigned int mods[ 8 ] = { 0, XCapL, XNumL, XNumL | XCapL, XScrL, XScrL | XCapL, @@ -1054,7 +1054,7 @@ int qtToX11Button( TQt::ButtonState button ) return Button3; return AnyButton; } - + int qtToX11State( TQt::ButtonState state ) { int ret = 0; @@ -1368,7 +1368,7 @@ bool Client::buttonPressEvent( Window w, int button, int state, int x, int y, in if ( bModKeyHeld ) { was_action = true; - switch (button) + switch (button) { case Button1: com = options->commandAll1(); @@ -1391,7 +1391,7 @@ bool Client::buttonPressEvent( Window w, int button, int state, int x, int y, in { was_action = true; perform_handled = true; - switch (button) + switch (button) { case Button1: com = options->commandWindow1(); @@ -1513,7 +1513,7 @@ bool Client::buttonReleaseEvent( Window w, int /*button*/, int state, int x, int if ( (state & ( Button1Mask & Button2Mask & Button3Mask )) == 0 ) { buttonDown = FALSE; - if ( moveResizeMode ) + if ( moveResizeMode ) { finishMoveResize( false ); // mouse position is still relative to old Client position, adjust it @@ -1564,7 +1564,7 @@ bool Client::motionNotifyEvent( Window w, int /*state*/, int x, int y, int x_roo { if( w != frameId() && w != decorationId() && w != moveResizeGrabWindow()) return true; // care only about the whole frame - if ( !buttonDown ) + if ( !buttonDown ) { Position newmode = mousePosition( TQPoint( x, y )); if( newmode != mode ) @@ -1682,7 +1682,7 @@ void Client::NETMoveResize( int x_root, int y_root, NET::Direction direction ) buttonDown = FALSE; setCursor( mode ); } - else if( direction >= NET::TopLeft && direction <= NET::Left ) + else if( direction >= NET::TopLeft && direction <= NET::Left ) { static const Position convert[] = { @@ -1733,7 +1733,7 @@ void Client::keyPressEvent( uint key_code ) key_code = key_code & 0xffff; int delta = is_control?1:is_alt?32:8; TQPoint pos = TQCursor::pos(); - switch ( key_code ) + switch ( key_code ) { case Key_Left: pos.rx() -= delta; diff --git a/twin/geometry.cpp b/twin/geometry.cpp index fc5f919cf..4bb6714ae 100644 --- a/twin/geometry.cpp +++ b/twin/geometry.cpp @@ -1899,7 +1899,7 @@ void Client::changeMaximize( bool vertical, bool horizontal, bool adjust ) if( horizontal ) max_mode = MaximizeMode( max_mode ^ MaximizeHorizontal ); } - + max_mode = rules()->checkMaximize( max_mode ); if( !adjust && max_mode == old_mode ) return; @@ -1948,9 +1948,9 @@ void Client::changeMaximize( bool vertical, bool horizontal, bool adjust ) { max_mode = MaximizeHorizontal; maxmode_restore = MaximizeRestore; - } + } } - + switch (max_mode) { @@ -2476,7 +2476,7 @@ void Client::checkUnrestrictedMoveResize() return; TQRect desktopArea = workspace()->clientArea( WorkArea, moveResizeGeom.center(), desktop()); int left_marge, right_marge, top_marge, bottom_marge, titlebar_marge; - // restricted move/resize - keep at least part of the titlebar always visible + // restricted move/resize - keep at least part of the titlebar always visible // how much must remain visible when moved away in that direction left_marge = KMIN( 100 + border_right, moveResizeGeom.width()); right_marge = KMIN( 100 + border_left, moveResizeGeom.width()); @@ -2552,7 +2552,7 @@ void Client::handleMoveResize( int x, int y, int x_root, int y_root ) int left_marge, right_marge, top_marge, bottom_marge, titlebar_marge; if( unrestrictedMoveResize ) // unrestricted, just don't let it go out completely left_marge = right_marge = top_marge = bottom_marge = titlebar_marge = 5; - else // restricted move/resize - keep at least part of the titlebar always visible + else // restricted move/resize - keep at least part of the titlebar always visible { // how much must remain visible when moved away in that direction left_marge = KMIN( 100 + border_right, moveResizeGeom.width()); diff --git a/twin/kcmtwin/twinoptions/windows.cpp b/twin/kcmtwin/twinoptions/windows.cpp index 617ad2fdf..b4f51401c 100644 --- a/twin/kcmtwin/twinoptions/windows.cpp +++ b/twin/kcmtwin/twinoptions/windows.cpp @@ -233,7 +233,7 @@ KFocusConfig::KFocusConfig (bool _standAlone, TDEConfig *_config, TQWidget * par "in the Notifications control module.</p>" ); TQWhatsThis::add( focusStealing, wtstr ); TQWhatsThis::add( focusStealingLabel, wtstr ); - + TQWhatsThis::add( autoRaiseOn, i18n("When this option is enabled, a window in the background will automatically" " come to the front when the mouse pointer has been over it for some time.") ); wtstr = i18n("This is the delay after which the window that the mouse pointer is over will automatically" @@ -265,7 +265,7 @@ KFocusConfig::KFocusConfig (bool _standAlone, TDEConfig *_config, TQWidget * par connect(focusCombo, TQT_SIGNAL(activated(int)), this, TQT_SLOT(updateActiveMouseScreen())); if (!TQApplication::desktop()->isVirtualDesktop() || - TQApplication::desktop()->numScreens() == 1) // No Ximerama + TQApplication::desktop()->numScreens() == 1) // No Ximerama { separateScreenFocus->hide(); activeMouseScreen->hide(); @@ -498,7 +498,7 @@ void KFocusConfig::load( void ) setClickRaise(key != "off"); setAutoRaiseEnabled(); // this will disable/hide the auto raise delay widget if focus==click setDelayFocusEnabled(); - + setSeparateScreenFocus( config->readBoolEntry(KWIN_SEPARATE_SCREEN_FOCUS, false)); // on by default for non click to focus policies setActiveMouseScreen( config->readBoolEntry(KWIN_ACTIVE_MOUSE_SCREEN, focusCombo->currentItem() != 0 )); @@ -1428,12 +1428,12 @@ KTranslucencyConfig::KTranslucencyConfig (bool _standAlone, TDEConfig *_config, TQWidget *tGroup = new TQWidget(tabW); TQVBoxLayout *vLay = new TQVBoxLayout (tGroup,KDialog::marginHint(), KDialog::spacingHint()); vLay->addSpacing(11); // to get the proper gb top offset - + onlyDecoTranslucent = new TQCheckBox(i18n("Apply translucency only to decoration"),tGroup); vLay->addWidget(onlyDecoTranslucent); - + vLay->addSpacing(11); - + TQGridLayout *gLay = new TQGridLayout(vLay,4,2,KDialog::spacingHint()); gLay->setColStretch(1,1); diff --git a/twin/kcmtwin/twinoptions/windows.h b/twin/kcmtwin/twinoptions/windows.h index 566f955b5..c7c4c711c 100644 --- a/twin/kcmtwin/twinoptions/windows.h +++ b/twin/kcmtwin/twinoptions/windows.h @@ -276,11 +276,11 @@ class KTranslucencyConfig : public TDECModule public: KTranslucencyConfig( bool _standAlone, TDEConfig *config, TQWidget *parent=0, const char* name=0 ); ~KTranslucencyConfig(); - + void load(); void save(); void defaults(); - + private: TQCheckBox *useTranslucency; TQCheckBox *activeWindowTransparency; diff --git a/twin/layers.cpp b/twin/layers.cpp index 17068a675..adc9bd436 100644 --- a/twin/layers.cpp +++ b/twin/layers.cpp @@ -424,7 +424,7 @@ void Workspace::raiseClientWithinApplication( Client* c ) StackingUpdatesBlocker blocker( this ); // ignore mainwindows - + // first try to put it above the top-most window of the application for( ClientList::Iterator it = unconstrained_stacking_order.fromLast(); it != unconstrained_stacking_order.end(); @@ -596,10 +596,10 @@ ClientList Workspace::constrainedStackingOrder() minimum_layer[ (*it)->group() ] = l; layer[ l ].append( *it ); } - ClientList stacking; + ClientList stacking; for( Layer lay = FirstLayer; lay < NumLayers; - ++lay ) + ++lay ) stacking += layer[ lay ]; #if 0 kdDebug() << "stacking2:" << endl; @@ -757,7 +757,7 @@ void Client::restackWindow( Window /*above TODO */, int detail, NET::RequestSour if( send_event ) sendSyntheticConfigureNotify(); } - + void Client::setKeepAbove( bool b ) { b = rules()->checkKeepAbove( b ); diff --git a/twin/utils.h b/twin/utils.h index e2e6e2a31..f1c1e772e 100644 --- a/twin/utils.h +++ b/twin/utils.h @@ -110,16 +110,19 @@ enum ShadeMode enum ActiveBorder { - ActiveTop, - ActiveTopRight, - ActiveRight, - ActiveBottomRight, - ActiveBottom, - ActiveBottomLeft, - ActiveLeft, - ActiveTopLeft, - ACTIVE_BORDER_COUNT, - ActiveNone + ActiveNone = 0, + + ActiveLeft = 1, + ActiveRight = 2, + ActiveTop = 4, + ActiveBottom = 8, + + ActiveTopLeft = ActiveTop | ActiveLeft, + ActiveTopRight = ActiveTop | ActiveRight, + ActiveBottomLeft = ActiveBottom | ActiveLeft, + ActiveBottomRight = ActiveBottom | ActiveRight, + + ACTIVE_BORDER_COUNT }; enum ActiveMaximizingMode @@ -129,7 +132,7 @@ enum ActiveMaximizingMode ActiveMaximizeMode }; -class Shape +class Shape { public: static bool available() { return twin_shape_version > 0; } @@ -147,12 +150,12 @@ class Shape const int ShapeInput = 2; #endif -class Motif +class Motif { public: static void readFlags( WId w, bool& noborder, bool& resize, bool& move, bool& minimize, bool& maximize, bool& close ); - struct MwmHints + struct MwmHints { ulong flags; ulong functions; @@ -248,7 +251,7 @@ KWIN_CHECK_PREDICATE( TruePredicate, cl == cl /*true, avoid warning about 'cl' * template< typename T > Client* findClientInList( const ClientList& list, T predicate ) { - for ( ClientList::ConstIterator it = list.begin(); it != list.end(); ++it) + for ( ClientList::ConstIterator it = list.begin(); it != list.end(); ++it) { if ( predicate( const_cast< const Client* >( *it))) return *it; diff --git a/twin/workspace.cpp b/twin/workspace.cpp index 950ebf92c..6f6bedb3e 100644 --- a/twin/workspace.cpp +++ b/twin/workspace.cpp @@ -201,8 +201,8 @@ Workspace::Workspace( bool restore ) updateXTime(); // needed for proper initialization of user_time in Client ctor - delayFocusTimer = 0; - + delayFocusTimer = 0; + active_time_first = GET_QT_X_TIME(); active_time_last = GET_QT_X_TIME(); @@ -315,7 +315,7 @@ void Workspace::init() // not used yet // topDock = 0L; // maximizedWindowCounter = 0; - + supportWindow = new TQWidget; XLowerWindow( tqt_xdisplay(), supportWindow->winId()); // see usage in layers.cpp @@ -461,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); @@ -469,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 ); @@ -810,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 @@ -820,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); } @@ -916,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 ); @@ -1033,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; @@ -1228,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)); @@ -1248,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) @@ -1300,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; @@ -1315,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() ); @@ -1352,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(); @@ -1361,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; @@ -1382,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 ) @@ -1410,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; /* @@ -1449,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) { @@ -1472,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 @@ -1481,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(); @@ -1508,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(); @@ -1556,7 +1556,7 @@ int Workspace::desktopToRight( int desktop ) const if (layoutOrientation == Qt::Vertical) { dt += y; - if ( dt >= numberOfDesktops() ) + if ( dt >= numberOfDesktops() ) { if ( options->rollOverDesktops ) dt -= numberOfDesktops(); @@ -1567,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; @@ -1587,7 +1587,7 @@ int Workspace::desktopToLeft( int desktop ) const if (layoutOrientation == Qt::Vertical) { dt -= y; - if ( dt < 0 ) + if ( dt < 0 ) { if ( options->rollOverDesktops ) dt += numberOfDesktops(); @@ -1598,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; @@ -1618,7 +1618,7 @@ int Workspace::desktopUp( int desktop ) const if (layoutOrientation == Qt::Horizontal) { dt -= x; - if ( dt < 0 ) + if ( dt < 0 ) { if ( options->rollOverDesktops ) dt += numberOfDesktops(); @@ -1629,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; @@ -1649,7 +1649,7 @@ int Workspace::desktopDown( int desktop ) const if (layoutOrientation == Qt::Horizontal) { dt += x; - if ( dt >= numberOfDesktops() ) + if ( dt >= numberOfDesktops() ) { if ( options->rollOverDesktops ) dt -= numberOfDesktops(); @@ -1660,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; @@ -1688,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 ]; @@ -1700,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 ]; @@ -1750,7 +1750,7 @@ void Workspace::sendClientToDesktop( Client* c, int desk, bool dont_activate ) else restackClientUnderActive( c ); } - else + else { raiseClient( c ); } @@ -1937,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; } @@ -1953,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 @@ -2086,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; @@ -2101,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; @@ -2152,7 +2152,7 @@ void Workspace::slotGrabDesktop() void Workspace::slotMouseEmulation() { - if ( mouse_emulation ) + if ( mouse_emulation ) { XUngrabKeyboard(tqt_xdisplay(), GET_QT_X_TIME()); mouse_emulation = FALSE; @@ -2162,7 +2162,7 @@ void Workspace::slotMouseEmulation() if ( XGrabKeyboard(tqt_xdisplay(), root, FALSE, GrabModeAsync, GrabModeAsync, - GET_QT_X_TIME()) == GrabSuccess ) + GET_QT_X_TIME()) == GrabSuccess ) { mouse_emulation = TRUE; mouse_emulation_state = 0; @@ -2184,7 +2184,7 @@ WId Workspace::getMouseEmulationWindow() uint state; Window w; Client * c = 0; - do + do { w = child; if (!c) @@ -2206,12 +2206,12 @@ 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_OBJECT_NAME_STRING) ) && !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; @@ -2227,7 +2227,7 @@ 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; @@ -2243,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; @@ -2258,9 +2258,9 @@ unsigned int Workspace::sendFakedMouseEvent( TQPoint pos, WId w, MouseEmulation break; } } - else + else { - switch ( button ) + switch ( button ) { case 2: state &= ~Button2Mask; @@ -2294,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: @@ -2339,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 ); @@ -2534,8 +2534,9 @@ void Workspace::checkActiveBorder(const TQPoint &pos, Time now) have_borders = true; } } - if( !have_borders ) + if (!have_borders) { return; + } // Mouse should not move more than this many pixels int distance_reset = activation_distance + 10; @@ -2575,49 +2576,37 @@ void Workspace::checkActiveBorder(const TQPoint &pos, Time now) active_qtop = pos.y() < activeTop + active_height_quart, active_qbottom = pos.y() > activeBottom - active_height_quart; - if (!active_left && !active_right && !active_top && !active_bottom) - return; + int border = ActiveNone; - kdDebug() << "active border activated " - << pos.x() << ":" << pos.y() << endl; + if (active_left) border |= ActiveLeft; + if (active_right) border |= ActiveRight; + if (active_top) border |= ActiveTop; + if (active_bottom) border |= ActiveBottom; - ActiveBorder border = ActiveNone; - if (active_left && active_top) { - border = ActiveTopLeft; - } - else if (active_right && active_top) { - border = ActiveTopRight; - } - else if (active_left && active_bottom) { - border = ActiveBottomLeft; + if (border == ActiveLeft || border == ActiveRight) { + if (active_qtop) border |= ActiveTop; + if (active_qbottom) border |= ActiveBottom; } - else if (active_right && active_bottom) { - border = ActiveBottomRight; - } - else if (active_left) { - border = active_qtop ? ActiveTopLeft - : (active_qbottom ? ActiveBottomLeft - : ActiveLeft); - } - else if (active_right) { - border = active_qtop ? ActiveTopRight - : (active_qbottom ? ActiveBottomRight - : ActiveRight); + + else if (border == ActiveTop || border == ActiveBottom) { + if (active_qleft) border |= ActiveLeft; + if (active_qright) border |= ActiveRight; } - else if (active_top) { - border = active_qleft ? ActiveTopLeft - : (active_qright ? ActiveTopRight - : ActiveTop); + + bool border_valid = false; + for (int i = 0; i < ACTIVE_BORDER_COUNT; ++i) { + if (border == (ActiveBorder)i) { + border_valid = true; + } } - else if (active_bottom) { - border = active_qleft ? ActiveBottomLeft - : (active_qright ? ActiveBottomRight - : ActiveBottom); + + if (!border_valid) { + abort(); } - else abort(); - if( active_windows[border] == None ) + if (border == ActiveNone || active_windows[border] == None) { return; + } if ((active_current_border == border) && (timestampDiff(active_time_last, now) < treshold_reset) && @@ -2625,10 +2614,6 @@ void Workspace::checkActiveBorder(const TQPoint &pos, Time now) ((pos-active_push_point).manhattanLength() < distance_reset)) { active_time_last = now; - - kdDebug() << "time diff between first time and now is: " - << timestampDiff(active_time_first, now) - << " vs threshold " << treshold_set << endl; if (timestampDiff(active_time_first, now) > treshold_set) { active_time_last_trigger = now; @@ -2642,7 +2627,7 @@ void Workspace::checkActiveBorder(const TQPoint &pos, Time now) if (options->activeBorders() == Options::ActiveSwitchAlways || options->activeBorders() == Options::ActiveSwitchOnMove) { - activeBorderSwitchDesktop(border, pos); + activeBorderSwitchDesktop((ActiveBorder)border, pos); return; // Don't reset cursor position } @@ -2662,7 +2647,7 @@ void Workspace::checkActiveBorder(const TQPoint &pos, Time now) { if (!movingClient->isResizable()) return; movingClient->setActiveBorderMode(ActiveTilingMode); - movingClient->setActiveBorder(border); + movingClient->setActiveBorder((ActiveBorder)border); movingClient->setActiveBorderMaximizing(true); } @@ -2676,7 +2661,7 @@ void Workspace::checkActiveBorder(const TQPoint &pos, Time now) // Desktop switching if (options->activeBorders() == Options::ActiveSwitchAlways && isSide) { - activeBorderSwitchDesktop(border, pos); + activeBorderSwitchDesktop((ActiveBorder)border, pos); return; // Don't reset cursor position } } @@ -2684,7 +2669,7 @@ void Workspace::checkActiveBorder(const TQPoint &pos, Time now) } else { - active_current_border = border; + active_current_border = (ActiveBorder)border; active_time_first = now; active_time_last = now; active_push_point = pos; @@ -2693,11 +2678,11 @@ void Workspace::checkActiveBorder(const TQPoint &pos, Time now) if ((options->activeBorders() == Options::ActiveSwitchAlways && !movingClient) || activation_distance < 2) { - // reset the pointer to find out whether the user is really pushing - // (the direction back from which it came, starting from top clockwise) - 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 whether the user is really pushing + // (ordered according to enum ActiveBorder minus ActiveNone) + const int xdiff[ACTIVE_BORDER_COUNT] = {1, -1, 0, 0, 1, -1, 1, -1}; + const int ydiff[ACTIVE_BORDER_COUNT] = {0, 0, 1, -1, 1, 1, -1, -1}; + TQCursor::setPos(pos.x() + xdiff[border - 1], pos.y() + ydiff[border - 1]); } } @@ -3113,8 +3098,8 @@ 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; diff --git a/twin/workspace.h b/twin/workspace.h index 3a724a4a2..37659332d 100644 --- a/twin/workspace.h +++ b/twin/workspace.h @@ -170,7 +170,7 @@ class Workspace : public TQObject, public KWinInterface, public KDecorationDefin */ int numberOfDesktops() const; void setNumberOfDesktops( int n ); - + int activeScreen() const; int numScreens() const; void checkActiveScreen( const Client* c ); @@ -257,7 +257,7 @@ class Workspace : public TQObject, public KWinInterface, public KDecorationDefin void sendPingToWindow( Window w, Time timestamp ); // called from Client::pingWindow() void sendTakeActivity( Client* c, Time timestamp, long flags ); // called from Client::takeActivity() - + bool kompmgrIsRunning(); void setOpacity(unsigned long winId, unsigned int opacityPercent); void setShadowSize(unsigned long winId, unsigned int shadowSizePercent); @@ -276,7 +276,7 @@ class Workspace : public TQObject, public KWinInterface, public KDecorationDefin void focusToNull(); // SELI public? enum FocusChainChange { FocusChainMakeFirst, FocusChainMakeLast, FocusChainUpdate }; void updateFocusChains( Client* c, FocusChainChange change ); - + bool forcedGlobalMouseGrab() const; void clientShortcutUpdated( Client* c ); bool shortcutAvailable( const TDEShortcut& cut, Client* ignore = NULL ) const; @@ -390,7 +390,7 @@ class Workspace : public TQObject, public KWinInterface, public KDecorationDefin void setupWindowShortcutDone( bool ); void updateClientArea(); - + // kompmgr, also dcop void startKompmgr(); @@ -496,7 +496,7 @@ class Workspace : public TQObject, public KWinInterface, public KDecorationDefin void activeBorderSwitchDesktop(ActiveBorder border, const TQPoint& pos); // ------------------ - + void helperDialog( const TQString& message, const Client* c ); void calcDesktopLayout(int &x, int &y) const; @@ -552,7 +552,7 @@ class Workspace : public TQObject, public KWinInterface, public KDecorationDefin ClientList global_focus_chain; // this one is only for things like tabbox's MRU ClientList should_get_focus; // last is most recent ClientList attention_chain; - + bool showing_desktop; ClientList showing_desktop_clients; int block_showing_desktop; @@ -654,7 +654,7 @@ class Workspace : public TQObject, public KWinInterface, public KDecorationDefin bool forced_global_mouse_grab; friend class StackingUpdatesBlocker; friend class Client; - + //kompmgr TQSlider *transSlider; TQPushButton *transButton; |