diff options
author | Mavridis Philippe <[email protected]> | 2023-07-09 17:01:04 +0300 |
---|---|---|
committer | Mavridis Philippe <[email protected]> | 2023-07-10 11:39:55 +0300 |
commit | 0339423ced3db53f9155c6c174d9508517358f9c (patch) | |
tree | 50010eac860f76137c71f3fb9f04498130812159 /twin/events.cpp | |
parent | becae3055bfd5da737f63d5558695030db91a3a9 (diff) | |
download | tdebase-0339423ced3db53f9155c6c174d9508517358f9c.tar.gz tdebase-0339423ced3db53f9155c6c174d9508517358f9c.zip |
twin: Minor code cleanup and refactoring
Refactoring concerns active border code.
Signed-off-by: Mavridis Philippe <[email protected]>
Diffstat (limited to 'twin/events.cpp')
-rw-r--r-- | twin/events.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
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; |