Don't require both mouse and keyboard grab for move/resize,
one of them is enough. Allows resising of the configure shortcut dialog. svn path=/trunk/kdebase/kwin/; revision=269294
This commit is contained in:
parent
162c76cf46
commit
2553476f53
3 changed files with 13 additions and 34 deletions
28
client.cpp
28
client.cpp
|
@ -83,7 +83,6 @@ Client::Client( Workspace *ws )
|
|||
ping_timer( NULL ),
|
||||
process_killer( NULL ),
|
||||
user_time( CurrentTime ), // not known yet
|
||||
input_grabbed( false ),
|
||||
allowed_actions( 0 ),
|
||||
block_geometry( 0 ),
|
||||
shade_geometry_change( false ),
|
||||
|
@ -399,33 +398,6 @@ void Client::setUserNoBorder( bool set )
|
|||
updateDecoration( true, false );
|
||||
}
|
||||
|
||||
bool Client::grabInput()
|
||||
{
|
||||
assert( !input_grabbed );
|
||||
assert( QWidget::keyboardGrabber() == NULL );
|
||||
assert( QWidget::mouseGrabber() == NULL );
|
||||
if( XGrabPointer( qt_xdisplay(), frameId(), False, ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
|
||||
GrabModeAsync, GrabModeAsync, None, cursor.handle(), qt_x_time ) != Success )
|
||||
return false;
|
||||
if( XGrabKeyboard( qt_xdisplay(), frameId(), False, GrabModeAsync, GrabModeAsync, qt_x_time ) != Success )
|
||||
{
|
||||
XUngrabPointer( qt_xdisplay(), qt_x_time );
|
||||
return false;
|
||||
}
|
||||
input_grabbed = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Client::ungrabInput()
|
||||
{
|
||||
assert( input_grabbed );
|
||||
assert( QWidget::keyboardGrabber() == NULL );
|
||||
assert( QWidget::mouseGrabber() == NULL );
|
||||
XUngrabKeyboard( qt_xdisplay(), qt_x_time );
|
||||
XUngrabPointer( qt_xdisplay(), qt_x_time );
|
||||
input_grabbed = false;
|
||||
}
|
||||
|
||||
void Client::updateShape()
|
||||
{
|
||||
if ( shape() )
|
||||
|
|
3
client.h
3
client.h
|
@ -337,8 +337,6 @@ class Client : public QObject, public KDecorationDefines
|
|||
void leaveMoveResize();
|
||||
void handleMoveResize( int x, int y, int x_root, int y_root );
|
||||
void positionGeometryTip();
|
||||
bool grabInput();
|
||||
void ungrabInput();
|
||||
void updateMouseGrab();
|
||||
void grabButton( int mod );
|
||||
void ungrabButton( int mod );
|
||||
|
@ -458,7 +456,6 @@ class Client : public QObject, public KDecorationDefines
|
|||
KProcess* process_killer;
|
||||
Time ping_timestamp;
|
||||
Time user_time;
|
||||
bool input_grabbed;
|
||||
unsigned long allowed_actions;
|
||||
QRect frame_geometry;
|
||||
QSize client_size;
|
||||
|
|
16
geometry.cpp
16
geometry.cpp
|
@ -1441,11 +1441,20 @@ class EatAllPaintEvents
|
|||
|
||||
static EatAllPaintEvents* eater = 0;
|
||||
|
||||
// TODO kontrolovat navratovou hodnotu
|
||||
bool Client::startMoveResize()
|
||||
{
|
||||
assert( !moveResizeMode );
|
||||
if( !grabInput())
|
||||
assert( QWidget::keyboardGrabber() == NULL );
|
||||
assert( QWidget::mouseGrabber() == NULL );
|
||||
if( QApplication::activePopupWidget() != NULL )
|
||||
return false; // popups have grab
|
||||
bool has_grab = false;
|
||||
if( XGrabPointer( qt_xdisplay(), frameId(), False, ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
|
||||
GrabModeAsync, GrabModeAsync, None, cursor.handle(), qt_x_time ) == Success )
|
||||
has_grab = true;
|
||||
if( XGrabKeyboard( qt_xdisplay(), frameId(), False, GrabModeAsync, GrabModeAsync, qt_x_time ) == Success )
|
||||
has_grab = true;
|
||||
if( !has_grab ) // at least one grab is necessary in order to be able to finish move/resize
|
||||
return false;
|
||||
if( mode == Center )
|
||||
setCursor( sizeAllCursor ); // change from arrow cursor if moving
|
||||
|
@ -1494,7 +1503,8 @@ void Client::leaveMoveResize()
|
|||
if ( ( isMove() && options->moveMode != Options::Opaque )
|
||||
|| ( isResize() && options->resizeMode != Options::Opaque ) )
|
||||
XUngrabServer( qt_xdisplay() );
|
||||
ungrabInput();
|
||||
XUngrabKeyboard( qt_xdisplay(), qt_x_time );
|
||||
XUngrabPointer( qt_xdisplay(), qt_x_time );
|
||||
workspace()->setClientIsMoving(0);
|
||||
if( move_faked_activity )
|
||||
workspace()->unfakeActivity( this );
|
||||
|
|
Loading…
Reference in a new issue