hook for snapping functionality

svn path=/trunk/kdebase/kwin/; revision=35032
This commit is contained in:
Matthias Ettrich 1999-11-25 16:38:11 +00:00
parent a12ab5338d
commit 378161e531
3 changed files with 27 additions and 14 deletions

View file

@ -877,6 +877,7 @@ void Client::mouseMoveEvent( QMouseEvent * e)
}
}
else if ( isMove() && geom.topLeft() != geometry().topLeft() ) {
geom.moveTopLeft( workspace()->adjustClientPosition( this, geom.topLeft() ) );
switch ( options->moveMode ) {
case Options::Opaque:
move( geom.topLeft() );

View file

@ -112,9 +112,9 @@ Workspace::Workspace()
grabKey(XK_Tab, ControlMask);
grabKey(XK_Tab, ControlMask | ShiftMask);
createKeybindings();
init();
control_grab = FALSE;
tab_grab = FALSE;
tab_box = new TabBox( this );
@ -806,7 +806,7 @@ void Workspace::clientHidden( Client* c )
}
QPopupMenu* Workspace::clientPopup( Client* c )
QPopupMenu* Workspace::clientPopup( Client* c )
{
popup_client = c;
if ( !popup ) {
@ -861,7 +861,7 @@ void Workspace::clientPopupActivated( int id )
popup_client->iconify();
else if ( id == popupIdFullscreen )
popup_client->fullScreen();
else if ( id == popupIdShade )
else if ( id == popupIdShade )
popup_client->setShade( !popup_client->isShade() );
}
@ -1255,7 +1255,7 @@ void Workspace::setCurrentDesktop( int new_desktop ){
atoms->net_current_desktop, XA_CARDINAL, 32,
PropModeReplace, (unsigned char *)&current_desktop, 1);
// try to restore the focus on this desktop
Client* c = active_client?active_client:previousClient(0);
Client* stop = c;
@ -1264,7 +1264,7 @@ void Workspace::setCurrentDesktop( int new_desktop ){
if ( c == stop )
break;
}
if ( !c || !c->isVisible() ) {
// there's no suitable client in the focus chain. Try to find any other client then.
for ( ClientList::ConstIterator it = stacking_order.begin(); it != stacking_order.end(); ++it) {
@ -1452,7 +1452,7 @@ void Workspace::createKeybindings(){
keys->connectItem( "Switch to desktop 6", this, SLOT( slotSwitchDesktop6() ));
keys->connectItem( "Switch to desktop 7", this, SLOT( slotSwitchDesktop7() ));
keys->connectItem( "Switch to desktop 8", this, SLOT( slotSwitchDesktop8() ));
keys->connectItem( "Pop-up window operations menu", this, SLOT( slotWindowOperations() ) );
keys->connectItem( "Window close", this, SLOT( slotWindowClose() ) );
@ -1486,7 +1486,7 @@ void Workspace::slotSwitchDesktop8(){
void Workspace::desktopPopupAboutToShow()
{
if ( !desk_popup )
if ( !desk_popup )
return;
desk_popup->clear();
desk_popup->insertItem( i18n("&All desktops"), 0 );
@ -1516,13 +1516,13 @@ void Workspace::sendToDesktop( int desk )
popup_client->setSticky( !popup_client->isSticky() );
return;
}
if ( popup_client->isSticky() )
popup_client->setSticky( FALSE );
if ( popup_client->isOnDesktop( desk ) )
return;
popup_client->setDesktop( desk );
popup_client->hide();
}
@ -1541,3 +1541,14 @@ void Workspace::slotWindowClose()
return;
popup_client->closeWindow();
}
/*
Client \a c is moved around to position \a pos. This gives the
workspace the opportunity to interveniate and to implement
snap-to-windows functionality.
*/
QPoint Workspace::adjustClientPosition( Client* c, QPoint pos )
{
return pos;
}

View file

@ -69,6 +69,7 @@ public:
void requestFocus( Client* c);
void doPlacement( Client* c );
QPoint adjustClientPosition( Client* c, QPoint pos );
void raiseClient( Client* c );
void clientHidden( Client* );
@ -91,7 +92,7 @@ public:
QPopupMenu* clientPopup( Client* );
void setDesktopClient( Client* );
void makeFullScreen( Client* );
@ -109,11 +110,11 @@ public slots:
void slotSwitchDesktop6();
void slotSwitchDesktop7();
void slotSwitchDesktop8();
void slotWindowOperations();
void slotWindowClose();
private slots:
void setDecorationStyle( int );
void desktopPopupAboutToShow();