merge branches/work/kaction-cleanup-branch: Simplify and clean up KShortcut
svn path=/trunk/KDE/kdebase/workspace/; revision=614599
This commit is contained in:
parent
37cdd4efb8
commit
ca449ecaee
5 changed files with 213 additions and 150 deletions
|
@ -779,7 +779,7 @@ ShortcutDialog::ShortcutDialog( const KShortcut& cut, QWidget* parent )
|
|||
|
||||
void ShortcutDialog::accept()
|
||||
{
|
||||
foreach( const QKeySequence &seq, shortcut().toList() )
|
||||
foreach( const QKeySequence &seq, shortcut() )
|
||||
{
|
||||
if( seq.isEmpty())
|
||||
break;
|
||||
|
|
26
sm.cpp
26
sm.cpp
|
@ -11,6 +11,7 @@ License. See the file "COPYING" for the exact licensing terms.
|
|||
|
||||
#include "sm.h"
|
||||
|
||||
//#include <kdebug.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <pwd.h>
|
||||
|
@ -22,7 +23,6 @@ License. See the file "COPYING" for the exact licensing terms.
|
|||
#include "client.h"
|
||||
#include <QSocketNotifier>
|
||||
#include <qsessionmanager.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
namespace KWinInternal
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ void Workspace::storeSession( KConfig* config, SMSavePhase phase )
|
|||
config->writeEntry( QString("skipPager")+n, c->skipPager() );
|
||||
config->writeEntry( QString("userNoBorder")+n, c->isUserNoBorder() );
|
||||
config->writeEntry( QString("windowType")+n, windowTypeToTxt( c->windowType()));
|
||||
config->writeEntry( QString("shortcut")+n, c->shortcut().toStringInternal());
|
||||
config->writeEntry( QString("shortcut")+n, c->shortcut().toString());
|
||||
config->writeEntry( QString("stackingOrder")+n, unconstrained_stacking_order.indexOf( c ));
|
||||
}
|
||||
}
|
||||
|
@ -257,28 +257,6 @@ bool Workspace::sessionInfoWindowTypeMatch( Client* c, SessionInfo* info )
|
|||
return info->windowType == c->windowType();
|
||||
}
|
||||
|
||||
// maybe needed later
|
||||
#if 0
|
||||
// KMainWindow's without name() given have WM_WINDOW_ROLE in the form
|
||||
// of <appname>-mainwindow#<number>
|
||||
// when comparing them for fake session info, it's probably better to check
|
||||
// them without the trailing number
|
||||
bool Workspace::windowRoleMatch( const QByteArray& role1, const QByteArray& role2 )
|
||||
{
|
||||
if( role1.isEmpty() && role2.isEmpty())
|
||||
return true;
|
||||
int pos1 = role1.find( '#' );
|
||||
int pos2 = role2.find( '#' );
|
||||
bool ret;
|
||||
if( pos1 < 0 || pos2 < 0 || pos1 != pos2 )
|
||||
ret = role1 == role2;
|
||||
else
|
||||
ret = qstrncmp( role1, role2, pos1 ) == 0;
|
||||
kDebug() << "WR:" << role1 << ":" << pos1 << ":" << role2 << ":" << pos2 << ":::" << ret << endl;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
static const char* const window_type_names[] =
|
||||
{
|
||||
"Unknown", "Normal" , "Desktop", "Dock", "Toolbar", "Menu", "Dialog",
|
||||
|
|
148
tabbox.cpp
148
tabbox.cpp
|
@ -43,7 +43,7 @@ namespace KWinInternal
|
|||
extern QPixmap* kwin_get_menu_pix_hack();
|
||||
|
||||
TabBox::TabBox( Workspace *ws, const char *name )
|
||||
: Q3Frame( 0, name, Qt::WNoAutoErase ), client(0), wspace(ws)
|
||||
: Q3Frame( 0, name, Qt::WNoAutoErase ), current_client( NULL ), wspace(ws)
|
||||
{
|
||||
setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
|
||||
setLineWidth(2);
|
||||
|
@ -57,10 +57,25 @@ TabBox::TabBox( Workspace *ws, const char *name )
|
|||
reconfigure();
|
||||
reset();
|
||||
connect(&delayedShowTimer, SIGNAL(timeout()), this, SLOT(show()));
|
||||
|
||||
XSetWindowAttributes attr;
|
||||
attr.override_redirect = 1;
|
||||
outline_left = XCreateWindow( display(), rootWindow(), 0, 0, 1, 1, 0,
|
||||
CopyFromParent, CopyFromParent, CopyFromParent, CWOverrideRedirect, &attr );
|
||||
outline_right = XCreateWindow( display(), rootWindow(), 0, 0, 1, 1, 0,
|
||||
CopyFromParent, CopyFromParent, CopyFromParent, CWOverrideRedirect, &attr );
|
||||
outline_top = XCreateWindow( display(), rootWindow(), 0, 0, 1, 1, 0,
|
||||
CopyFromParent, CopyFromParent, CopyFromParent, CWOverrideRedirect, &attr );
|
||||
outline_bottom = XCreateWindow( display(), rootWindow(), 0, 0, 1, 1, 0,
|
||||
CopyFromParent, CopyFromParent, CopyFromParent, CWOverrideRedirect, &attr );
|
||||
}
|
||||
|
||||
TabBox::~TabBox()
|
||||
{
|
||||
XDestroyWindow( display(), outline_left );
|
||||
XDestroyWindow( display(), outline_right );
|
||||
XDestroyWindow( display(), outline_top );
|
||||
XDestroyWindow( display(), outline_bottom );
|
||||
}
|
||||
|
||||
|
||||
|
@ -111,7 +126,9 @@ void TabBox::createClientList(ClientList &list, int desktop /*-1 = all*/, Client
|
|||
else if( !list.contains( modal ))
|
||||
list += modal;
|
||||
else
|
||||
; // nothing
|
||||
{
|
||||
// nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,10 +164,10 @@ void TabBox::reset()
|
|||
|
||||
if ( mode() == WindowsMode )
|
||||
{
|
||||
client = workspace()->activeClient();
|
||||
setCurrentClient( workspace()->activeClient());
|
||||
|
||||
// get all clients to show
|
||||
createClientList(clients, options_traverse_all ? -1 : workspace()->currentDesktop(), client, true);
|
||||
createClientList(clients, options_traverse_all ? -1 : workspace()->currentDesktop(), current_client, true);
|
||||
|
||||
// calculate maximum caption width
|
||||
cw = fontMetrics().width(no_tasks)+20;
|
||||
|
@ -227,7 +244,8 @@ void TabBox::nextPrev( bool next)
|
|||
{
|
||||
if ( mode() == WindowsMode )
|
||||
{
|
||||
Client* firstClient = 0;
|
||||
Client* firstClient = NULL;
|
||||
Client* client = current_client;
|
||||
do
|
||||
{
|
||||
if ( next )
|
||||
|
@ -247,6 +265,7 @@ void TabBox::nextPrev( bool next)
|
|||
break;
|
||||
}
|
||||
} while ( client && !clients.contains( client ));
|
||||
setCurrentClient( client );
|
||||
}
|
||||
else if( mode() == DesktopMode )
|
||||
{
|
||||
|
@ -284,9 +303,18 @@ Client* TabBox::currentClient()
|
|||
{
|
||||
if ( mode() != WindowsMode )
|
||||
return 0;
|
||||
if (!workspace()->hasClient( client ))
|
||||
if (!workspace()->hasClient( current_client ))
|
||||
return 0;
|
||||
return client;
|
||||
return current_client;
|
||||
}
|
||||
|
||||
void TabBox::setCurrentClient( Client* c )
|
||||
{
|
||||
if( current_client != c )
|
||||
{
|
||||
current_client = c;
|
||||
updateOutline();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -308,6 +336,11 @@ int TabBox::currentDesktop()
|
|||
*/
|
||||
void TabBox::showEvent( QShowEvent* )
|
||||
{
|
||||
updateOutline();
|
||||
XRaiseWindow( display(), outline_left );
|
||||
XRaiseWindow( display(), outline_right );
|
||||
XRaiseWindow( display(), outline_top );
|
||||
XRaiseWindow( display(), outline_bottom );
|
||||
raise();
|
||||
}
|
||||
|
||||
|
@ -317,6 +350,10 @@ void TabBox::showEvent( QShowEvent* )
|
|||
*/
|
||||
void TabBox::hideEvent( QHideEvent* )
|
||||
{
|
||||
XUnmapWindow( display(), outline_left );
|
||||
XUnmapWindow( display(), outline_right );
|
||||
XUnmapWindow( display(), outline_top );
|
||||
XUnmapWindow( display(), outline_bottom );
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -355,7 +392,7 @@ void TabBox::drawContents( QPainter * )
|
|||
if ( workspace()->hasClient( *it ) ) // safety
|
||||
{
|
||||
// draw highlight background
|
||||
if ( (*it) == currentClient() )
|
||||
if ( (*it) == current_client )
|
||||
p.fillRect(x, y, r.width(), lineHeight, palette().brush( QPalette::Highlight ));
|
||||
|
||||
// draw icon
|
||||
|
@ -389,10 +426,10 @@ void TabBox::drawContents( QPainter * )
|
|||
else
|
||||
s += (*it)->caption();
|
||||
|
||||
s = KStringHandler::cPixelSqueeze(s, fontMetrics(), r.width() - 5 - iconWidth - 8);
|
||||
s = fontMetrics().elidedText(s, Qt::ElideMiddle, r.width() - 5 - iconWidth - 8);
|
||||
|
||||
// draw text
|
||||
if ( (*it) == currentClient() )
|
||||
if ( (*it) == current_client )
|
||||
p.setPen(palette().color( QPalette::HighlightedText ));
|
||||
else if( (*it)->isMinimized())
|
||||
{
|
||||
|
@ -510,6 +547,91 @@ void TabBox::drawContents( QPainter * )
|
|||
localPainter.drawImage( QPoint( r.x(), r.y() ), pix.toImage() );
|
||||
}
|
||||
|
||||
void TabBox::updateOutline()
|
||||
{
|
||||
Client* c = currentClient();
|
||||
if( c == NULL || this->isHidden() || !c->isShown( true ) || !c->isOnCurrentDesktop())
|
||||
{
|
||||
XUnmapWindow( display(), outline_left );
|
||||
XUnmapWindow( display(), outline_right );
|
||||
XUnmapWindow( display(), outline_top );
|
||||
XUnmapWindow( display(), outline_bottom );
|
||||
return;
|
||||
}
|
||||
// left/right parts are between top/bottom, they don't reach as far as the corners
|
||||
XMoveResizeWindow( display(), outline_left, c->x(), c->y() + 5, 5, c->height() - 10 );
|
||||
XMoveResizeWindow( display(), outline_right, c->x() + c->width() - 5, c->y() + 5, 5, c->height() - 10 );
|
||||
XMoveResizeWindow( display(), outline_top, c->x(), c->y(), c->width(), 5 );
|
||||
XMoveResizeWindow( display(), outline_bottom, c->x(), c->y() + c->height() - 5, c->width(), 5 );
|
||||
{
|
||||
QPixmap pix( 5, c->height() - 10 );
|
||||
QPainter p( &pix );
|
||||
p.setPen( Qt::white );
|
||||
p.drawLine( 0, 0, 0, pix.height() - 1 );
|
||||
p.drawLine( 4, 0, 4, pix.height() - 1 );
|
||||
p.setPen( Qt::gray );
|
||||
p.drawLine( 1, 0, 1, pix.height() - 1 );
|
||||
p.drawLine( 3, 0, 3, pix.height() - 1 );
|
||||
p.setPen( Qt::black );
|
||||
p.drawLine( 2, 0, 2, pix.height() - 1 );
|
||||
p.end();
|
||||
XSetWindowBackgroundPixmap( display(), outline_left, pix.handle());
|
||||
XSetWindowBackgroundPixmap( display(), outline_right, pix.handle());
|
||||
}
|
||||
{
|
||||
QPixmap pix( c->width(), 5 );
|
||||
QPainter p( &pix );
|
||||
p.setPen( Qt::white );
|
||||
p.drawLine( 0, 0, pix.width() - 1 - 0, 0 );
|
||||
p.drawLine( 4, 4, pix.width() - 1 - 4, 4 );
|
||||
p.drawLine( 0, 0, 0, 4 );
|
||||
p.drawLine( pix.width() - 1 - 0, 0, pix.width() - 1 - 0, 4 );
|
||||
p.setPen( Qt::gray );
|
||||
p.drawLine( 1, 1, pix.width() - 1 - 1, 1 );
|
||||
p.drawLine( 3, 3, pix.width() - 1 - 3, 3 );
|
||||
p.drawLine( 1, 1, 1, 4 );
|
||||
p.drawLine( 3, 3, 3, 4 );
|
||||
p.drawLine( pix.width() - 1 - 1, 1, pix.width() - 1 - 1, 4 );
|
||||
p.drawLine( pix.width() - 1 - 3, 3, pix.width() - 1 - 3, 4 );
|
||||
p.setPen( Qt::black );
|
||||
p.drawLine( 2, 2, pix.width() - 1 - 2, 2 );
|
||||
p.drawLine( 2, 2, 2, 4 );
|
||||
p.drawLine( pix.width() - 1 - 2, 2, pix.width() - 1 - 2, 4 );
|
||||
p.end();
|
||||
XSetWindowBackgroundPixmap( display(), outline_top, pix.handle());
|
||||
}
|
||||
{
|
||||
QPixmap pix( c->width(), 5 );
|
||||
QPainter p( &pix );
|
||||
p.setPen( Qt::white );
|
||||
p.drawLine( 4, 0, pix.width() - 1 - 4, 0 );
|
||||
p.drawLine( 0, 4, pix.width() - 1 - 0, 4 );
|
||||
p.drawLine( 0, 4, 0, 0 );
|
||||
p.drawLine( pix.width() - 1 - 0, 4, pix.width() - 1 - 0, 0 );
|
||||
p.setPen( Qt::gray );
|
||||
p.drawLine( 3, 1, pix.width() - 1 - 3, 1 );
|
||||
p.drawLine( 1, 3, pix.width() - 1 - 1, 3 );
|
||||
p.drawLine( 3, 1, 3, 0 );
|
||||
p.drawLine( 1, 3, 1, 0 );
|
||||
p.drawLine( pix.width() - 1 - 3, 1, pix.width() - 1 - 3, 0 );
|
||||
p.drawLine( pix.width() - 1 - 1, 3, pix.width() - 1 - 1, 0 );
|
||||
p.setPen( Qt::black );
|
||||
p.drawLine( 2, 2, pix.width() - 1 - 2, 2 );
|
||||
p.drawLine( 2, 0, 2, 2 );
|
||||
p.drawLine( pix.width() - 1 - 2, 0, pix.width() - 1 - 2 , 2 );
|
||||
p.end();
|
||||
XSetWindowBackgroundPixmap( display(), outline_bottom, pix.handle());
|
||||
}
|
||||
XClearWindow( display(), outline_left );
|
||||
XClearWindow( display(), outline_right );
|
||||
XClearWindow( display(), outline_top );
|
||||
XClearWindow( display(), outline_bottom );
|
||||
XMapWindow( display(), outline_left );
|
||||
XMapWindow( display(), outline_right );
|
||||
XMapWindow( display(), outline_top );
|
||||
XMapWindow( display(), outline_bottom );
|
||||
}
|
||||
|
||||
void TabBox::hide()
|
||||
{
|
||||
delayedShowTimer.stop();
|
||||
|
@ -587,7 +709,7 @@ void TabBox::handleMouseEvent( XEvent* e )
|
|||
{
|
||||
if( workspace()->hasClient( *it ) && (num == 0) ) // safety
|
||||
{
|
||||
client = *it;
|
||||
setCurrentClient( *it );
|
||||
break;
|
||||
}
|
||||
num--;
|
||||
|
@ -1031,8 +1153,8 @@ void Workspace::tabBoxKeyPress( int keyQt )
|
|||
backward = cutWalkThroughWindowsReverse.contains( keyQt );
|
||||
if (forward || backward)
|
||||
{
|
||||
kDebug(125) << "== " << cutWalkThroughWindows.toStringInternal()
|
||||
<< " or " << cutWalkThroughWindowsReverse.toStringInternal() << endl;
|
||||
kDebug(125) << "== " << cutWalkThroughWindows.toString()
|
||||
<< " or " << cutWalkThroughWindowsReverse.toString() << endl;
|
||||
KDEWalkThroughWindows( forward );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,18 +111,22 @@ QMenu* Workspace::clientPopup()
|
|||
desk_popup_index = popup->actions().count();
|
||||
|
||||
if (options->useTranslucency){
|
||||
trans_popup = new QMenu( popup );
|
||||
trans_popup->setFont(KGlobalSettings::menuFont());
|
||||
connect( trans_popup, SIGNAL( triggered(QAction*) ), this, SLOT( setPopupClientOpacity(QAction*)));
|
||||
const int levels[] = { 100, 90, 75, 50, 25, 10 };
|
||||
for( unsigned int i = 0;
|
||||
i < sizeof( levels ) / sizeof( levels[ 0 ] );
|
||||
++i )
|
||||
{
|
||||
action = trans_popup->addAction( QString::number( levels[ i ] ) + "%" );
|
||||
action->setCheckable( true );
|
||||
action->setData( levels[ i ] );
|
||||
}
|
||||
QMenu *trans_popup = new QMenu( popup );
|
||||
QVBoxLayout *transLayout = new QVBoxLayout(trans_popup);
|
||||
trans_popup->setLayout( transLayout );
|
||||
transButton = new QPushButton(trans_popup);
|
||||
transButton->setObjectName("transButton");
|
||||
transButton->setToolTip( i18n("Reset opacity to default value"));
|
||||
transSlider = new QSlider(trans_popup);
|
||||
transSlider->setObjectName( "transSlider" );
|
||||
transSlider->setRange( 0, 100 );
|
||||
transSlider->setValue( 100 );
|
||||
transSlider->setOrientation( Qt::Vertical );
|
||||
transSlider->setToolTip( i18n("Slide this to set the window's opacity"));
|
||||
connect(transButton, SIGNAL(clicked()), SLOT(resetClientOpacity()));
|
||||
connect(transButton, SIGNAL(clicked()), trans_popup, SLOT(hide()));
|
||||
connect(transSlider, SIGNAL(valueChanged(int)), SLOT(setTransButtonText(int)));
|
||||
connect(transSlider, SIGNAL(valueChanged(int)), this, SLOT(setPopupClientOpacity(int)));
|
||||
action = popup->addMenu( trans_popup );
|
||||
action->setText( i18n("&Opacity") );
|
||||
}
|
||||
|
@ -181,14 +185,31 @@ QMenu* Workspace::clientPopup()
|
|||
return popup;
|
||||
}
|
||||
|
||||
void Workspace::setPopupClientOpacity( QAction* action )
|
||||
//sets the transparency of the client to given value(given by slider)
|
||||
void Workspace::setPopupClientOpacity(int value)
|
||||
{
|
||||
if( active_popup_client == NULL )
|
||||
return;
|
||||
int level = action->data().toInt();
|
||||
active_popup_client->setOpacity( level / 100.0 );
|
||||
// TODO
|
||||
}
|
||||
|
||||
void Workspace::setTransButtonText(int value)
|
||||
{
|
||||
value = 100 - value;
|
||||
if(value < 0)
|
||||
transButton->setText("000 %");
|
||||
else if (value >= 100 )
|
||||
transButton->setText("100 %");
|
||||
else if(value < 10)
|
||||
transButton->setText("00"+QString::number(value)+" %");
|
||||
else if(value < 100)
|
||||
transButton->setText('0'+QString::number(value)+" %");
|
||||
}
|
||||
|
||||
void Workspace::resetClientOpacity()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
The client popup menu will become visible soon.
|
||||
|
||||
|
@ -223,16 +244,6 @@ void Workspace::clientPopupAboutToShow()
|
|||
mNoBorderOpAction->setChecked( active_popup_client->noBorder() );
|
||||
mMinimizeOpAction->setEnabled( active_popup_client->isMinimizable() );
|
||||
mCloseOpAction->setEnabled( active_popup_client->isCloseable() );
|
||||
if (options->useTranslucency)
|
||||
{
|
||||
foreach( QAction* action, trans_popup->actions())
|
||||
{
|
||||
if( action->data().toInt() == qRound( active_popup_client->opacity() * 100 ))
|
||||
action->setChecked( true );
|
||||
else
|
||||
action->setChecked( false );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -393,7 +404,7 @@ void Workspace::clientShortcutUpdated( Client* c )
|
|||
QAction* action = client_keys->action( key.toLatin1().constData() );
|
||||
if( !c->shortcut().isEmpty())
|
||||
{
|
||||
action->setShortcuts(c->shortcut().toList());
|
||||
action->setShortcuts(c->shortcut());
|
||||
connect(action, SIGNAL(triggered(bool)), c, SLOT(shortcutActivated()));
|
||||
action->setEnabled( true );
|
||||
}
|
||||
|
@ -430,7 +441,7 @@ void Workspace::clientPopupActivated( QAction *action )
|
|||
}
|
||||
|
||||
|
||||
void Workspace::performWindowOperation( Client* c, Options::WindowOperation op )
|
||||
void Workspace::performWindowOperation( Client* c, Options::WindowOperation op )
|
||||
{
|
||||
if ( !c )
|
||||
return;
|
||||
|
@ -439,7 +450,7 @@ void Workspace::performWindowOperation( Client* c, Options::WindowOperation op )
|
|||
QCursor::setPos( c->geometry().center() );
|
||||
if (op == Options::ResizeOp || op == Options::UnrestrictedResizeOp )
|
||||
QCursor::setPos( c->geometry().bottomRight());
|
||||
switch ( op )
|
||||
switch ( op )
|
||||
{
|
||||
case Options::MoveOp:
|
||||
c->performMouseCommand( Options::MouseMove, QCursor::pos() );
|
||||
|
@ -528,7 +539,7 @@ void Workspace::performWindowOperation( Client* c, Options::WindowOperation op )
|
|||
bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPos, bool handled )
|
||||
{
|
||||
bool replay = false;
|
||||
switch (command)
|
||||
switch (command)
|
||||
{
|
||||
case Options::MouseRaise:
|
||||
workspace()->raiseClient( this );
|
||||
|
@ -668,10 +679,10 @@ bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPo
|
|||
workspace()->windowToNextDesktop( this );
|
||||
break;
|
||||
case Options::MouseOpacityMore:
|
||||
setOpacity( qMin( opacity() + 0.1, 1.0 ));
|
||||
// TODO
|
||||
break;
|
||||
case Options::MouseOpacityLess:
|
||||
setOpacity( qMax( opacity() - 0.1, 0.0 ));
|
||||
// TODO
|
||||
break;
|
||||
case Options::MouseNothing:
|
||||
replay = true;
|
||||
|
@ -695,13 +706,13 @@ void Workspace::slotActivateAttentionWindow()
|
|||
void Workspace::slotSwitchDesktopNext()
|
||||
{
|
||||
int d = currentDesktop() + 1;
|
||||
if ( d > numberOfDesktops() )
|
||||
if ( d > numberOfDesktops() )
|
||||
{
|
||||
if ( options->rollOverDesktops )
|
||||
if ( options->rollOverDesktops )
|
||||
{
|
||||
d = 1;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -712,7 +723,7 @@ void Workspace::slotSwitchDesktopNext()
|
|||
void Workspace::slotSwitchDesktopPrevious()
|
||||
{
|
||||
int d = currentDesktop() - 1;
|
||||
if ( d <= 0 )
|
||||
if ( d <= 0 )
|
||||
{
|
||||
if ( options->rollOverDesktops )
|
||||
d = numberOfDesktops();
|
||||
|
@ -897,7 +908,7 @@ void Workspace::slotWindowToNextDesktop()
|
|||
{
|
||||
windowToNextDesktop( active_popup_client ? active_popup_client : active_client );
|
||||
}
|
||||
|
||||
|
||||
void Workspace::windowToNextDesktop( Client* c )
|
||||
{
|
||||
int d = currentDesktop() + 1;
|
||||
|
@ -919,7 +930,7 @@ void Workspace::slotWindowToPreviousDesktop()
|
|||
{
|
||||
windowToPreviousDesktop( active_popup_client ? active_popup_client : active_client );
|
||||
}
|
||||
|
||||
|
||||
void Workspace::windowToPreviousDesktop( Client* c )
|
||||
{
|
||||
int d = currentDesktop() - 1;
|
||||
|
@ -1014,7 +1025,7 @@ void Workspace::slotSendToDesktop( QAction *action )
|
|||
int desk = action->data().toInt();
|
||||
if ( !active_popup_client )
|
||||
return;
|
||||
if ( desk == 0 )
|
||||
if ( desk == 0 )
|
||||
{ // the 'on_all_desktops' menu entry
|
||||
active_popup_client->setOnAllDesktops( !active_popup_client->isOnAllDesktops());
|
||||
return;
|
||||
|
@ -1173,7 +1184,7 @@ bool Workspace::shortcutAvailable( const KShortcut& cut, Client* ignore ) const
|
|||
++it )
|
||||
{
|
||||
if( (*it) != ignore && (*it)->shortcut() == cut )
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
94
utils.cpp
94
utils.cpp
|
@ -30,7 +30,6 @@ License. See the file "COPYING" for the exact licensing terms.
|
|||
#include <X11/extensions/shape.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <QX11Info>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "atoms.h"
|
||||
|
@ -43,68 +42,19 @@ namespace KWinInternal
|
|||
|
||||
#ifndef KCMRULES
|
||||
|
||||
bool Extensions::has_shape = false;
|
||||
int Extensions::shape_event_base = 0;
|
||||
bool Extensions::has_randr = false;
|
||||
int Extensions::randr_event_base = 0;
|
||||
bool Extensions::has_damage = false;
|
||||
int Extensions::damage_event_base = 0;
|
||||
bool Extensions::has_composite = false;
|
||||
bool Extensions::has_composite_overlay = false;
|
||||
bool Extensions::has_fixes = false;
|
||||
// used to store the return values of
|
||||
// XShapeQueryExtension.
|
||||
// Necessary since shaped window are an extension to X
|
||||
int Shape::kwin_shape_version = 0;
|
||||
int Shape::kwin_shape_event = 0;
|
||||
|
||||
void Extensions::init()
|
||||
{
|
||||
int dummy;
|
||||
has_shape = XShapeQueryExtension( display(), &shape_event_base, &dummy);
|
||||
#ifdef HAVE_XRANDR
|
||||
has_randr = XRRQueryExtension( display(), &randr_event_base, &dummy );
|
||||
if( has_randr )
|
||||
{
|
||||
int major, minor;
|
||||
XRRQueryVersion( display(), &major, &minor );
|
||||
has_randr = ( major > 1 || ( major == 1 && minor >= 1 ) );
|
||||
}
|
||||
#else
|
||||
has_randr = false;
|
||||
#endif
|
||||
#ifdef HAVE_XDAMAGE
|
||||
has_damage = XDamageQueryExtension( display(), &damage_event_base, &dummy );
|
||||
#else
|
||||
has_damage = false;
|
||||
#endif
|
||||
#ifdef HAVE_XCOMPOSITE
|
||||
has_composite = XCompositeQueryExtension( display(), &dummy, &dummy );
|
||||
if( has_composite )
|
||||
{
|
||||
int major, minor;
|
||||
XCompositeQueryVersion( display(), &major, &minor );
|
||||
has_composite = ( major > 0 || minor >= 2 );
|
||||
has_composite_overlay = ( major > 0 || minor >= 3 );
|
||||
}
|
||||
#else
|
||||
has_composite = false;
|
||||
has_composite_overlay = false;
|
||||
#endif
|
||||
#ifdef HAVE_XFIXES
|
||||
has_fixes = XFixesQueryExtension( display(), &dummy, &dummy );
|
||||
#else
|
||||
has_fixes = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
int Extensions::shapeNotifyEvent()
|
||||
{
|
||||
return shape_event_base + ShapeNotify;
|
||||
}
|
||||
|
||||
// does the window w need a shape combine mask around it?
|
||||
bool Extensions::hasShape( Window w )
|
||||
// does the window w need a shape combine mask around it?
|
||||
bool Shape::hasShape( WId w)
|
||||
{
|
||||
int xws, yws, xbs, ybs;
|
||||
unsigned int wws, hws, wbs, hbs;
|
||||
int boundingShaped = 0, clipShaped = 0;
|
||||
if( !Extensions::shapeAvailable())
|
||||
if (!available())
|
||||
return false;
|
||||
XShapeQueryExtents(display(), w,
|
||||
&boundingShaped, &xws, &yws, &wws, &hws,
|
||||
|
@ -112,22 +62,21 @@ bool Extensions::hasShape( Window w )
|
|||
return boundingShaped != 0;
|
||||
}
|
||||
|
||||
int Extensions::randrNotifyEvent()
|
||||
int Shape::shapeEvent()
|
||||
{
|
||||
#ifdef HAVE_XRANDR
|
||||
return randr_event_base + RRScreenChangeNotify;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
return kwin_shape_event;
|
||||
}
|
||||
|
||||
int Extensions::damageNotifyEvent()
|
||||
void Shape::init()
|
||||
{
|
||||
#ifdef HAVE_XDAMAGE
|
||||
return damage_event_base + XDamageNotify;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
kwin_shape_version = 0;
|
||||
int dummy;
|
||||
if( !XShapeQueryExtension( display(), &kwin_shape_event, &dummy ))
|
||||
return;
|
||||
int major, minor;
|
||||
if( !XShapeQueryVersion( display(), &major, &minor ))
|
||||
return;
|
||||
kwin_shape_version = major * 0x10 + minor;
|
||||
}
|
||||
|
||||
void Motif::readFlags( WId w, bool& noborder, bool& resize, bool& move,
|
||||
|
@ -351,6 +300,7 @@ bool grabbedXServer()
|
|||
{
|
||||
return server_grab_count > 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool isLocalMachine( const QByteArray& host )
|
||||
|
@ -388,7 +338,7 @@ ShortcutDialog::ShortcutDialog( const KShortcut& cut )
|
|||
|
||||
void ShortcutDialog::accept()
|
||||
{
|
||||
foreach( const QKeySequence &seq, shortcut().toList() )
|
||||
foreach( const QKeySequence &seq, shortcut() )
|
||||
{
|
||||
if( seq.isEmpty())
|
||||
break;
|
||||
|
@ -414,6 +364,8 @@ void ShortcutDialog::accept()
|
|||
KShortcutDialog::accept();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#ifndef KCMRULES
|
||||
|
|
Loading…
Reference in a new issue