Make it possible to do all kinds of strange things when mousewheeling
the titlebar or Alt+mousewheeling the window. FEATURE:44318 FEATURE:66519 FEATURE:76188 svn path=/trunk/KDE/kdebase/kwin/; revision=410058
This commit is contained in:
parent
abc0141416
commit
fc90a04635
19 changed files with 293 additions and 48 deletions
|
@ -123,6 +123,11 @@ void Bridge::titlebarDblClickOperation()
|
|||
c->workspace()->performWindowOperation( c, options->operationTitlebarDblClick());
|
||||
}
|
||||
|
||||
void Bridge::titlebarMouseWheelOperation( int delta )
|
||||
{
|
||||
c->performMouseCommand( options->operationTitlebarMouseWheel( delta ), QCursor::pos());
|
||||
}
|
||||
|
||||
void Bridge::setShade( bool set )
|
||||
{
|
||||
c->setShade( set ? ShadeNormal : ShadeNone );
|
||||
|
|
1
bridge.h
1
bridge.h
|
@ -57,6 +57,7 @@ class Bridge : public KDecorationBridge
|
|||
virtual void showContextHelp();
|
||||
virtual void setDesktop( int desktop );
|
||||
virtual void titlebarDblClickOperation();
|
||||
virtual void titlebarMouseWheelOperation( int delta );
|
||||
virtual void setShade( bool set );
|
||||
virtual void setKeepAbove( bool );
|
||||
virtual void setKeepBelow( bool );
|
||||
|
|
|
@ -810,6 +810,11 @@ void Client::setShade( ShadeMode mode )
|
|||
void Client::shadeHover()
|
||||
{
|
||||
setShade( ShadeHover );
|
||||
cancelShadeHover();
|
||||
}
|
||||
|
||||
void Client::cancelShadeHover()
|
||||
{
|
||||
delete shadeHoverTimer;
|
||||
shadeHoverTimer = 0;
|
||||
}
|
||||
|
|
1
client.h
1
client.h
|
@ -275,6 +275,7 @@ class Client : public QObject, public KDecorationDefines
|
|||
void maximize( MaximizeMode );
|
||||
void toggleShade();
|
||||
void showContextHelp();
|
||||
void cancelShadeHover();
|
||||
void cancelAutoRaise();
|
||||
void destroyClient();
|
||||
void checkActiveModal();
|
||||
|
|
|
@ -49,6 +49,10 @@ bool MyClient::eventFilter( QObject* o, QEvent* e )
|
|||
mouseDoubleClickEvent( static_cast< QMouseEvent* >( e ) );
|
||||
return true;
|
||||
|
||||
case QEvent::Wheel:
|
||||
wheelEvent( static_cast< QWheelEvent* >( e ));
|
||||
return true;
|
||||
|
||||
case QEvent::MouseButtonPress:
|
||||
processMousePressEvent( static_cast< QMouseEvent* >( e ) );
|
||||
return true;
|
||||
|
|
50
events.cpp
50
events.cpp
|
@ -939,8 +939,7 @@ void Client::leaveNotifyEvent( XCrossingEvent* e )
|
|||
{
|
||||
cancelAutoRaise();
|
||||
workspace()->cancelDelayFocus();
|
||||
delete shadeHoverTimer;
|
||||
shadeHoverTimer = 0;
|
||||
cancelShadeHover();
|
||||
if ( shade_mode == ShadeHover && !moveResizeMode && !buttonDown )
|
||||
setShade( ShadeNormal );
|
||||
}
|
||||
|
@ -1076,6 +1075,15 @@ bool Client::eventFilter( QObject* o, QEvent* e )
|
|||
return motionNotifyEvent( decorationId(), qtToX11State( ev->state()),
|
||||
ev->x(), ev->y(), ev->globalX(), ev->globalY() );
|
||||
}
|
||||
if( e->type() == QEvent::Wheel )
|
||||
{
|
||||
QWheelEvent* ev = static_cast< QWheelEvent* >( e );
|
||||
bool r = buttonPressEvent( decorationId(), ev->delta() > 0 ? Button4 : Button5, qtToX11State( ev->state()),
|
||||
ev->x(), ev->y(), ev->globalX(), ev->globalY() );
|
||||
r = r || buttonReleaseEvent( decorationId(), ev->delta() > 0 ? Button4 : Button5, qtToX11State( ev->state()),
|
||||
ev->x(), ev->y(), ev->globalX(), ev->globalY() );
|
||||
return r;
|
||||
}
|
||||
if( e->type() == QEvent::Resize )
|
||||
{
|
||||
QResizeEvent* ev = static_cast< QResizeEvent* >( e );
|
||||
|
@ -1120,35 +1128,7 @@ bool Client::buttonPressEvent( Window w, int button, int state, int x, int y, in
|
|||
Options::MouseCommand com = Options::MouseNothing;
|
||||
bool was_action = false;
|
||||
bool perform_handled = false;
|
||||
if (keyModX != 0 && (state & keyModX) && (state & ControlMask))
|
||||
{
|
||||
switch (button)
|
||||
{
|
||||
case Button5:
|
||||
if (opacity_ > 0)
|
||||
{
|
||||
setOpacity(TRUE, (opacity_ > 0xCCCCCCC) ? opacity_ - 0xCCCCCCC : 0);
|
||||
custom_opacity = true;
|
||||
}
|
||||
XAllowEvents(qt_xdisplay(), SyncPointer, CurrentTime );
|
||||
return true;
|
||||
case Button4:
|
||||
if (opacity_ < 0xFFFFFFFF)
|
||||
{
|
||||
if (opacity_ < 0xF3333333){
|
||||
setOpacity(TRUE, opacity_ + 0xCCCCCCC);
|
||||
custom_opacity = true;
|
||||
}
|
||||
else{
|
||||
setOpacity(FALSE, 0xFFFFFFFF);
|
||||
custom_opacity = false;
|
||||
}
|
||||
}
|
||||
XAllowEvents(qt_xdisplay(), SyncPointer, CurrentTime );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if ( bModKeyHeld )
|
||||
if ( bModKeyHeld )
|
||||
{
|
||||
was_action = true;
|
||||
switch (button)
|
||||
|
@ -1162,6 +1142,10 @@ bool Client::buttonPressEvent( Window w, int button, int state, int x, int y, in
|
|||
case Button3:
|
||||
com = options->commandAll3();
|
||||
break;
|
||||
case Button4:
|
||||
case Button5:
|
||||
com = options->operationWindowMouseWheel( button == Button4 ? 120 : -120 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1201,8 +1185,8 @@ bool Client::buttonPressEvent( Window w, int button, int state, int x, int y, in
|
|||
if ( isSpecialWindow() && !isOverride())
|
||||
replay = TRUE;
|
||||
|
||||
if( w == wrapperId()) // these can come only from a grab
|
||||
XAllowEvents(qt_xdisplay(), replay? ReplayPointer : SyncPointer, CurrentTime ); //qt_x_time);
|
||||
if( w == wrapperId()) // these can come only from a grab
|
||||
XAllowEvents(qt_xdisplay(), replay? ReplayPointer : SyncPointer, CurrentTime ); //qt_x_time);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -404,6 +404,10 @@ void KDecorationPreviewBridge::titlebarDblClickOperation()
|
|||
{
|
||||
}
|
||||
|
||||
void KDecorationPreviewBridge::titlebarMouseWheelOperation( int )
|
||||
{
|
||||
}
|
||||
|
||||
void KDecorationPreviewBridge::setShade( bool )
|
||||
{
|
||||
}
|
||||
|
|
|
@ -100,6 +100,7 @@ class KDecorationPreviewBridge
|
|||
virtual void showContextHelp();
|
||||
virtual void setDesktop( int desktop );
|
||||
virtual void titlebarDblClickOperation();
|
||||
virtual void titlebarMouseWheelOperation( int delta );
|
||||
virtual void setShade( bool set );
|
||||
virtual void setKeepAbove( bool );
|
||||
virtual void setKeepBelow( bool );
|
||||
|
|
|
@ -140,8 +140,8 @@ KTitleBarActionsConfig::KTitleBarActionsConfig (bool _standAlone, KConfig *_conf
|
|||
QGrid *grid;
|
||||
QGroupBox *box;
|
||||
QLabel *label;
|
||||
QString strMouseButton1, strMouseButton3;
|
||||
QString txtButton1, txtButton3;
|
||||
QString strMouseButton1, strMouseButton3, strMouseWheel;
|
||||
QString txtButton1, txtButton3, txtButton4;
|
||||
QStringList items;
|
||||
bool leftHandedMouse = ( KGlobalSettings::mouseSettings().handed == KGlobalSettings::KMouseSettings::LeftHanded);
|
||||
|
||||
|
@ -171,6 +171,30 @@ KTitleBarActionsConfig::KTitleBarActionsConfig (bool _standAlone, KConfig *_conf
|
|||
|
||||
label->setBuddy(combo);
|
||||
|
||||
/** Mouse Wheel Events **************/
|
||||
QHBoxLayout *hlayoutW = new QHBoxLayout(layout);
|
||||
strMouseWheel = i18n("Titlebar wheel event:");
|
||||
label = new QLabel(strMouseWheel, this);
|
||||
hlayoutW->addWidget(label);
|
||||
txtButton4 = i18n("Handle mouse wheel events");
|
||||
QWhatsThis::add( label, txtButton4);
|
||||
|
||||
// Titlebar and frame mouse Wheel
|
||||
QComboBox* comboW = new QComboBox(this);
|
||||
comboW->insertItem(i18n("Raise/Lower"));
|
||||
comboW->insertItem(i18n("Shade/Unshade"));
|
||||
comboW->insertItem(i18n("Maximize/Restore"));
|
||||
comboW->insertItem(i18n("Keep Above/Below"));
|
||||
comboW->insertItem(i18n("Move to Previous/Next Desktop"));
|
||||
comboW->insertItem(i18n("Change Opacity"));
|
||||
comboW->insertItem(i18n("Nothing"));
|
||||
comboW->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed));
|
||||
connect(comboW, SIGNAL(activated(int)), SLOT(changed()));
|
||||
hlayoutW->addWidget(comboW);
|
||||
coTiAct4 = comboW;
|
||||
QWhatsThis::add(comboW, txtButton4);
|
||||
label->setBuddy(comboW);
|
||||
|
||||
/** Titlebar and frame **************/
|
||||
|
||||
box = new QVGroupBox( i18n("Titlebar && Frame"), this, "Titlebar and Frame");
|
||||
|
@ -412,6 +436,26 @@ const char* const tbl_All[] = {
|
|||
"Nothing",
|
||||
"" };
|
||||
|
||||
const char* tbl_TiWAc[] = {
|
||||
"Raise/Lower",
|
||||
"Shade/Unshade",
|
||||
"Maximize/Restore",
|
||||
"Above/Below",
|
||||
"Previous/Next Desktop",
|
||||
"Change Opacity",
|
||||
"Nothing",
|
||||
"" };
|
||||
|
||||
const char* tbl_AllW[] = {
|
||||
"Raise/Lower",
|
||||
"Shade/Unshade",
|
||||
"Maximize/Restore",
|
||||
"Above/Below",
|
||||
"Previous/Next Desktop",
|
||||
"Change Opacity",
|
||||
"Nothing",
|
||||
"" };
|
||||
|
||||
static const char* tbl_num_lookup( const char* const arr[], int pos )
|
||||
{
|
||||
for( int i = 0;
|
||||
|
@ -447,6 +491,8 @@ void KTitleBarActionsConfig::setComboText( QComboBox* combo, const char*txt )
|
|||
combo->setCurrentItem( tbl_txt_lookup( tbl_TiAc, txt ));
|
||||
else if( combo == coTiInAct1 || combo == coTiInAct2 || combo == coTiInAct3 )
|
||||
combo->setCurrentItem( tbl_txt_lookup( tbl_TiInAc, txt ));
|
||||
else if( combo == coTiAct4 )
|
||||
combo->setCurrentItem( tbl_txt_lookup( tbl_TiWAc, txt ));
|
||||
else if( combo == coMax[0] || combo == coMax[1] || combo == coMax[2] )
|
||||
{
|
||||
combo->setCurrentItem( tbl_txt_lookup( tbl_Max, txt ));
|
||||
|
@ -471,6 +517,11 @@ const char* KTitleBarActionsConfig::functionTiInAc( int i )
|
|||
return tbl_num_lookup( tbl_TiInAc, i );
|
||||
}
|
||||
|
||||
const char* KTitleBarActionsConfig::functionTiWAc(int i)
|
||||
{
|
||||
return tbl_num_lookup( tbl_TiWAc, i );
|
||||
}
|
||||
|
||||
const char* KTitleBarActionsConfig::functionMax( int i )
|
||||
{
|
||||
return tbl_num_lookup( tbl_Max, i );
|
||||
|
@ -487,6 +538,7 @@ void KTitleBarActionsConfig::load()
|
|||
setComboText(coTiAct1,config->readEntry("CommandActiveTitlebar1","Raise").ascii());
|
||||
setComboText(coTiAct2,config->readEntry("CommandActiveTitlebar2","Lower").ascii());
|
||||
setComboText(coTiAct3,config->readEntry("CommandActiveTitlebar3","Operations menu").ascii());
|
||||
setComboText(coTiAct4,config->readEntry("CommandTitlebarWheel","Nothing").ascii());
|
||||
setComboText(coTiInAct1,config->readEntry("CommandInactiveTitlebar1","Activate and raise").ascii());
|
||||
setComboText(coTiInAct2,config->readEntry("CommandInactiveTitlebar2","Activate and lower").ascii());
|
||||
setComboText(coTiInAct3,config->readEntry("CommandInactiveTitlebar3","Operations menu").ascii());
|
||||
|
@ -504,6 +556,7 @@ void KTitleBarActionsConfig::save()
|
|||
config->writeEntry("CommandActiveTitlebar2", functionTiAc(coTiAct2->currentItem()));
|
||||
config->writeEntry("CommandActiveTitlebar3", functionTiAc(coTiAct3->currentItem()));
|
||||
config->writeEntry("CommandInactiveTitlebar1", functionTiInAc(coTiInAct1->currentItem()));
|
||||
config->writeEntry("CommandTitlebarWheel", functionTiWAc(coTiAct4->currentItem()));
|
||||
config->writeEntry("CommandInactiveTitlebar2", functionTiInAc(coTiInAct2->currentItem()));
|
||||
config->writeEntry("CommandInactiveTitlebar3", functionTiInAc(coTiInAct3->currentItem()));
|
||||
|
||||
|
@ -522,6 +575,7 @@ void KTitleBarActionsConfig::defaults()
|
|||
setComboText(coTiAct1,"Raise");
|
||||
setComboText(coTiAct2,"Lower");
|
||||
setComboText(coTiAct3,"Operations menu");
|
||||
setComboText(coTiAct4,"Nothing");
|
||||
setComboText(coTiInAct1,"Activate and raise");
|
||||
setComboText(coTiInAct2,"Activate and lower");
|
||||
setComboText(coTiInAct3,"Operations menu");
|
||||
|
@ -533,7 +587,7 @@ void KTitleBarActionsConfig::defaults()
|
|||
KWindowActionsConfig::KWindowActionsConfig (bool _standAlone, KConfig *_config, QWidget * parent, const char *)
|
||||
: KCModule(parent, "kcmkwm"), config(_config), standAlone(_standAlone)
|
||||
{
|
||||
QString strWin1, strWin2, strWin3, strAllKey, strAll1, strAll2, strAll3;
|
||||
QString strWin1, strWin2, strWin3, strAllKey, strAll1, strAll2, strAll3, strAllW;
|
||||
QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint());
|
||||
QGrid *grid;
|
||||
QGroupBox *box;
|
||||
|
@ -622,7 +676,7 @@ KWindowActionsConfig::KWindowActionsConfig (bool _standAlone, KConfig *_config,
|
|||
QWhatsThis::add( box, i18n("Here you can customize KDE's behavior when clicking somewhere into"
|
||||
" a window while pressing a modifier key."));
|
||||
|
||||
grid = new QGrid(4, Qt::Vertical, box);
|
||||
grid = new QGrid(5, Qt::Vertical, box);
|
||||
|
||||
// Labels
|
||||
label = new QLabel(i18n("Modifier key:"), grid);
|
||||
|
@ -657,6 +711,11 @@ KWindowActionsConfig::KWindowActionsConfig (bool _standAlone, KConfig *_config,
|
|||
label = new QLabel(strMouseButton3, grid);
|
||||
QWhatsThis::add( label, strAll3);
|
||||
|
||||
label = new QLabel(i18n("Modifier key + mouse wheel:"), grid);
|
||||
strAllW = i18n("Here you can customize KDE's behavior when scrolling with the mouse wheel"
|
||||
" in a window while pressing the modifier key.");
|
||||
QWhatsThis::add( label, strAllW);
|
||||
|
||||
// Combo's
|
||||
combo = new QComboBox(grid);
|
||||
combo->insertItem(i18n("Meta"));
|
||||
|
@ -693,6 +752,18 @@ KWindowActionsConfig::KWindowActionsConfig (bool _standAlone, KConfig *_config,
|
|||
coAll3 = combo;
|
||||
QWhatsThis::add( combo, strAll3 );
|
||||
|
||||
combo = new QComboBox(grid);
|
||||
combo->insertItem(i18n("Raise/Lower"));
|
||||
combo->insertItem(i18n("Shade/Unshade"));
|
||||
combo->insertItem(i18n("Maximize/Restore"));
|
||||
combo->insertItem(i18n("Keep Above/Below"));
|
||||
combo->insertItem(i18n("Move to Previous/Next Desktop"));
|
||||
combo->insertItem(i18n("Change Opacity"));
|
||||
combo->insertItem(i18n("Nothing"));
|
||||
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
|
||||
coAllW = combo;
|
||||
QWhatsThis::add( combo, strAllW );
|
||||
|
||||
layout->addStretch();
|
||||
|
||||
load();
|
||||
|
@ -712,6 +783,8 @@ void KWindowActionsConfig::setComboText( QComboBox* combo, const char*txt )
|
|||
combo->setCurrentItem( tbl_txt_lookup( tbl_AllKey, txt ));
|
||||
else if( combo == coAll1 || combo == coAll2 || combo == coAll3 )
|
||||
combo->setCurrentItem( tbl_txt_lookup( tbl_All, txt ));
|
||||
else if( combo == coAllW )
|
||||
combo->setCurrentItem( tbl_txt_lookup( tbl_AllW, txt ));
|
||||
else
|
||||
abort();
|
||||
}
|
||||
|
@ -731,6 +804,11 @@ const char* KWindowActionsConfig::functionAll( int i )
|
|||
return tbl_num_lookup( tbl_All, i );
|
||||
}
|
||||
|
||||
const char* KWindowActionsConfig::functionAllW(int i)
|
||||
{
|
||||
return tbl_num_lookup( tbl_AllW, i );
|
||||
}
|
||||
|
||||
void KWindowActionsConfig::load()
|
||||
{
|
||||
config->setGroup( "MouseBindings");
|
||||
|
@ -741,6 +819,7 @@ void KWindowActionsConfig::load()
|
|||
setComboText(coAll1,config->readEntry("CommandAll1","Move").ascii());
|
||||
setComboText(coAll2,config->readEntry("CommandAll2","Toggle raise and lower").ascii());
|
||||
setComboText(coAll3,config->readEntry("CommandAll3","Resize").ascii());
|
||||
setComboText(coAllW,config->readEntry("CommandAllWheel","Nothing").ascii());
|
||||
}
|
||||
|
||||
void KWindowActionsConfig::save()
|
||||
|
@ -753,6 +832,7 @@ void KWindowActionsConfig::save()
|
|||
config->writeEntry("CommandAll1", functionAll(coAll1->currentItem()));
|
||||
config->writeEntry("CommandAll2", functionAll(coAll2->currentItem()));
|
||||
config->writeEntry("CommandAll3", functionAll(coAll3->currentItem()));
|
||||
config->writeEntry("CommandAllWheel", functionAllW(coAllW->currentItem()));
|
||||
|
||||
if (standAlone)
|
||||
{
|
||||
|
@ -772,4 +852,5 @@ void KWindowActionsConfig::defaults()
|
|||
setComboText (coAll1,"Move");
|
||||
setComboText(coAll2,"Toggle raise and lower");
|
||||
setComboText(coAll3,"Resize");
|
||||
setComboText(coAllW,"Nothing");
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ private:
|
|||
QComboBox* coTiAct1;
|
||||
QComboBox* coTiAct2;
|
||||
QComboBox* coTiAct3;
|
||||
QComboBox* coTiAct4;
|
||||
QComboBox* coTiInAct1;
|
||||
QComboBox* coTiInAct2;
|
||||
QComboBox* coTiInAct3;
|
||||
|
@ -81,6 +82,7 @@ private:
|
|||
|
||||
const char* functionTiDbl(int);
|
||||
const char* functionTiAc(int);
|
||||
const char* functionTiWAc(int);
|
||||
const char* functionTiInAc(int);
|
||||
const char* functionMax(int);
|
||||
|
||||
|
@ -117,6 +119,7 @@ private:
|
|||
QComboBox* coAll1;
|
||||
QComboBox* coAll2;
|
||||
QComboBox* coAll3;
|
||||
QComboBox* coAllW;
|
||||
|
||||
KConfig *config;
|
||||
bool standAlone;
|
||||
|
@ -124,6 +127,7 @@ private:
|
|||
const char* functionWin(int);
|
||||
const char* functionAllKey(int);
|
||||
const char* functionAll(int);
|
||||
const char* functionAllW(int);
|
||||
|
||||
void setComboText(QComboBox* combo, const char* text);
|
||||
const char* fixup( const char* s );
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <qtooltip.h>
|
||||
#include <qwidget.h>
|
||||
|
||||
// #include <kdebug.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
#include <kapplication.h>
|
||||
#include <kdecorationfactory.h>
|
||||
|
@ -694,6 +694,13 @@ void KCommonDecoration::mouseDoubleClickEvent(QMouseEvent *e)
|
|||
titlebarDblClickOperation();
|
||||
}
|
||||
|
||||
void KCommonDecoration::wheelEvent(QWheelEvent *e)
|
||||
{
|
||||
int tb = layoutMetric(LM_TitleEdgeTop)+layoutMetric(LM_TitleHeight)+layoutMetric(LM_TitleEdgeBottom);
|
||||
if (isSetShade() || e->pos().y() <= tb )
|
||||
titlebarMouseWheelOperation( e->delta());
|
||||
}
|
||||
|
||||
KCommonDecoration::Position KCommonDecoration::mousePosition(const QPoint &point) const
|
||||
{
|
||||
const int corner = 18+3*layoutMetric(LM_BorderBottom, false)/2;
|
||||
|
@ -827,6 +834,9 @@ bool KCommonDecoration::eventFilter( QObject* o, QEvent* e )
|
|||
case QEvent::MouseButtonPress:
|
||||
processMousePressEvent( static_cast< QMouseEvent* >( e ));
|
||||
return true;
|
||||
case QEvent::Wheel:
|
||||
wheelEvent( static_cast< QWheelEvent* >( e ));
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -255,6 +255,7 @@ class KWIN_EXPORT KCommonDecoration : public KDecoration
|
|||
virtual bool eventFilter( QObject* o, QEvent* e );
|
||||
virtual void resizeEvent(QResizeEvent *e);
|
||||
virtual void mouseDoubleClickEvent(QMouseEvent *e);
|
||||
virtual void wheelEvent(QWheelEvent *e);
|
||||
|
||||
private:
|
||||
void resetLayout();
|
||||
|
|
|
@ -274,6 +274,11 @@ void KDecoration::titlebarDblClickOperation()
|
|||
bridge_->titlebarDblClickOperation();
|
||||
}
|
||||
|
||||
void KDecoration::titlebarMouseWheelOperation( int delta )
|
||||
{
|
||||
bridge_->titlebarMouseWheelOperation( delta );
|
||||
}
|
||||
|
||||
void KDecoration::setShade( bool set )
|
||||
{
|
||||
bridge_->setShade( set );
|
||||
|
|
|
@ -796,6 +796,13 @@ class KWIN_EXPORT KDecoration
|
|||
* operation.
|
||||
*/
|
||||
void titlebarDblClickOperation();
|
||||
/**
|
||||
* This function performs the operation configured as titlebar wheel mouse
|
||||
* operation.
|
||||
* @param delta the mouse wheel delta
|
||||
* @since 3.5
|
||||
*/
|
||||
void titlebarMouseWheelOperation( int delta );
|
||||
/**
|
||||
* Shades or unshades the decorated window.
|
||||
* @param set Whether the window should be shaded
|
||||
|
|
|
@ -96,6 +96,7 @@ class KDecorationBridge : public KDecorationDefines
|
|||
virtual void showContextHelp() = 0;
|
||||
virtual void setDesktop( int desktop ) = 0;
|
||||
virtual void titlebarDblClickOperation() = 0;
|
||||
virtual void titlebarMouseWheelOperation( int delta ) = 0;
|
||||
virtual void setShade( bool set ) = 0;
|
||||
virtual void setKeepAbove( bool ) = 0;
|
||||
virtual void setKeepBelow( bool ) = 0;
|
||||
|
|
35
options.cpp
35
options.cpp
|
@ -160,6 +160,7 @@ unsigned long Options::updateSettings()
|
|||
CmdInactiveTitlebar1 = mouseCommand(config->readEntry("CommandInactiveTitlebar1","Activate and raise"), true );
|
||||
CmdInactiveTitlebar2 = mouseCommand(config->readEntry("CommandInactiveTitlebar2","Activate and lower"), true );
|
||||
CmdInactiveTitlebar3 = mouseCommand(config->readEntry("CommandInactiveTitlebar3","Operations menu"), true );
|
||||
CmdTitlebarWheel = mouseWheelCommand(config->readEntry("CommandTitlebarWheel","Nothing"));
|
||||
CmdWindow1 = mouseCommand(config->readEntry("CommandWindow1","Activate, raise and pass click"), false );
|
||||
CmdWindow2 = mouseCommand(config->readEntry("CommandWindow2","Activate and pass click"), false );
|
||||
CmdWindow3 = mouseCommand(config->readEntry("CommandWindow3","Activate and pass click"), false );
|
||||
|
@ -167,6 +168,7 @@ unsigned long Options::updateSettings()
|
|||
CmdAll1 = mouseCommand(config->readEntry("CommandAll1","Move"), false );
|
||||
CmdAll2 = mouseCommand(config->readEntry("CommandAll2","Toggle raise and lower"), false );
|
||||
CmdAll3 = mouseCommand(config->readEntry("CommandAll3","Resize"), false );
|
||||
CmdAllWheel = mouseWheelCommand(config->readEntry("CommandAllWheel","Nothing"));
|
||||
|
||||
//translucency settings
|
||||
config->setGroup( "Notification Messages" );
|
||||
|
@ -266,6 +268,18 @@ Options::MouseCommand Options::mouseCommand(const QString &name, bool restricted
|
|||
return MouseNothing;
|
||||
}
|
||||
|
||||
Options::MouseWheelCommand Options::mouseWheelCommand(const QString &name)
|
||||
{
|
||||
QString lowerName = name.lower();
|
||||
if (lowerName == "raise/lower") return MouseWheelRaiseLower;
|
||||
if (lowerName == "shade/unshade") return MouseWheelShadeUnshade;
|
||||
if (lowerName == "maximize/restore") return MouseWheelMaximizeRestore;
|
||||
if (lowerName == "above/below") return MouseWheelAboveBelow;
|
||||
if (lowerName == "previous/next desktop") return MouseWheelPreviousNextDesktop;
|
||||
if (lowerName == "change opacity") return MouseWheelChangeOpacity;
|
||||
return MouseWheelNothing;
|
||||
}
|
||||
|
||||
bool Options::showGeometryTip()
|
||||
{
|
||||
return show_geometry_tip;
|
||||
|
@ -285,6 +299,27 @@ bool Options::checkIgnoreFocusStealing( const Client* c )
|
|||
{
|
||||
return ignoreFocusStealingClasses.contains(QString::fromLatin1(c->resourceClass()));
|
||||
}
|
||||
|
||||
Options::MouseCommand Options::wheelToMouseCommand( MouseWheelCommand com, int delta )
|
||||
{
|
||||
switch( com )
|
||||
{
|
||||
case MouseWheelRaiseLower:
|
||||
return delta > 0 ? MouseRaise : MouseLower;
|
||||
case MouseWheelShadeUnshade:
|
||||
return delta > 0 ? MouseSetShade : MouseUnsetShade;
|
||||
case MouseWheelMaximizeRestore:
|
||||
return delta > 0 ? MouseMaximize : MouseRestore;
|
||||
case MouseWheelAboveBelow:
|
||||
return delta > 0 ? MouseAbove : MouseBelow;
|
||||
case MouseWheelPreviousNextDesktop:
|
||||
return delta > 0 ? MousePreviousDesktop : MouseNextDesktop;
|
||||
case MouseWheelChangeOpacity:
|
||||
return delta > 0 ? MouseOpacityMore : MouseOpacityLess;
|
||||
default:
|
||||
return MouseNothing;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Options::MoveResizeMode Options::stringToMoveResizeMode( const QString& s )
|
||||
|
|
30
options.h
30
options.h
|
@ -208,10 +208,30 @@ class Options : public KDecorationOptions
|
|||
MouseMove, MouseUnrestrictedMove,
|
||||
MouseActivateRaiseAndMove, MouseActivateRaiseAndUnrestrictedMove,
|
||||
MouseResize, MouseUnrestrictedResize,
|
||||
MouseShade,
|
||||
MouseMinimize,
|
||||
MouseShade, MouseSetShade, MouseUnsetShade,
|
||||
MouseMaximize, MouseRestore, MouseMinimize,
|
||||
MouseNextDesktop, MousePreviousDesktop,
|
||||
MouseAbove, MouseBelow,
|
||||
MouseOpacityMore, MouseOpacityLess,
|
||||
MouseNothing
|
||||
};
|
||||
|
||||
enum MouseWheelCommand
|
||||
{
|
||||
MouseWheelRaiseLower, MouseWheelShadeUnshade, MouseWheelMaximizeRestore,
|
||||
MouseWheelAboveBelow, MouseWheelPreviousNextDesktop,
|
||||
MouseWheelChangeOpacity,
|
||||
MouseWheelNothing
|
||||
};
|
||||
|
||||
MouseCommand operationTitlebarMouseWheel( int delta )
|
||||
{
|
||||
return wheelToMouseCommand( CmdTitlebarWheel, delta );
|
||||
}
|
||||
MouseCommand operationWindowMouseWheel( int delta )
|
||||
{
|
||||
return wheelToMouseCommand( CmdAllWheel, delta );
|
||||
}
|
||||
|
||||
MouseCommand commandActiveTitlebar1() { return CmdActiveTitlebar1; }
|
||||
MouseCommand commandActiveTitlebar2() { return CmdActiveTitlebar2; }
|
||||
|
@ -230,6 +250,7 @@ class Options : public KDecorationOptions
|
|||
|
||||
static WindowOperation windowOperation(const QString &name, bool restricted );
|
||||
static MouseCommand mouseCommand(const QString &name, bool restricted );
|
||||
static MouseWheelCommand mouseWheelCommand(const QString &name);
|
||||
|
||||
/**
|
||||
* @returns true if the Geometry Tip should be shown during a window move/resize.
|
||||
|
@ -285,12 +306,14 @@ class Options : public KDecorationOptions
|
|||
MouseCommand CmdInactiveTitlebar1;
|
||||
MouseCommand CmdInactiveTitlebar2;
|
||||
MouseCommand CmdInactiveTitlebar3;
|
||||
MouseWheelCommand CmdTitlebarWheel;
|
||||
MouseCommand CmdWindow1;
|
||||
MouseCommand CmdWindow2;
|
||||
MouseCommand CmdWindow3;
|
||||
MouseCommand CmdAll1;
|
||||
MouseCommand CmdAll2;
|
||||
MouseCommand CmdAll3;
|
||||
MouseWheelCommand CmdAllWheel;
|
||||
uint CmdAllModKey;
|
||||
|
||||
int electric_borders;
|
||||
|
@ -300,7 +323,8 @@ class Options : public KDecorationOptions
|
|||
bool desktop_topmenu;
|
||||
// List of window classes for which not to use focus stealing prevention
|
||||
QStringList ignoreFocusStealingClasses;
|
||||
|
||||
|
||||
MouseCommand wheelToMouseCommand( MouseWheelCommand com, int delta );
|
||||
};
|
||||
|
||||
extern Options* options;
|
||||
|
|
|
@ -379,6 +379,8 @@ void Workspace::performWindowOperation( Client* c, Options::WindowOperation op )
|
|||
case Options::VMaximizeOp:
|
||||
c->maximize( c->maximizeMode() ^ Client::MaximizeVertical );
|
||||
break;
|
||||
case Options::RestoreOp:
|
||||
c->maximize( Client::MaximizeRestore );
|
||||
case Options::MinimizeOp:
|
||||
c->minimize();
|
||||
break;
|
||||
|
@ -412,6 +414,9 @@ void Workspace::performWindowOperation( Client* c, Options::WindowOperation op )
|
|||
lowerClient( c );
|
||||
break;
|
||||
}
|
||||
case Options::OperationsOp:
|
||||
c->performMouseCommand( Options::MouseShade, QCursor::pos());
|
||||
break;
|
||||
case Options::WindowRulesOp:
|
||||
editWindowRules( c );
|
||||
break;
|
||||
|
@ -421,7 +426,7 @@ void Workspace::performWindowOperation( Client* c, Options::WindowOperation op )
|
|||
case Options::LowerOp:
|
||||
lowerClient(c);
|
||||
break;
|
||||
default:
|
||||
case Options::NoOp:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -441,9 +446,16 @@ bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPo
|
|||
workspace()->lowerClient( this );
|
||||
break;
|
||||
case Options::MouseShade :
|
||||
delete shadeHoverTimer;
|
||||
shadeHoverTimer = 0;
|
||||
toggleShade();
|
||||
cancelShadeHover();
|
||||
break;
|
||||
case Options::MouseSetShade:
|
||||
setShade( ShadeNormal );
|
||||
cancelShadeHover();
|
||||
break;
|
||||
case Options::MouseUnsetShade:
|
||||
setShade( ShadeNone );
|
||||
cancelShadeHover();
|
||||
break;
|
||||
case Options::MouseOperationsMenu:
|
||||
if ( isActive() & options->clickRaise )
|
||||
|
@ -531,12 +543,62 @@ bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPo
|
|||
}
|
||||
break;
|
||||
}
|
||||
case Options::MouseMaximize:
|
||||
maximize( Client::MaximizeFull );
|
||||
break;
|
||||
case Options::MouseRestore:
|
||||
maximize( Client::MaximizeRestore );
|
||||
break;
|
||||
case Options::MouseMinimize:
|
||||
minimize();
|
||||
break;
|
||||
case Options::MouseAbove:
|
||||
{
|
||||
StackingUpdatesBlocker blocker( workspace());
|
||||
if( keepBelow())
|
||||
setKeepBelow( false );
|
||||
else
|
||||
setKeepAbove( true );
|
||||
break;
|
||||
}
|
||||
case Options::MouseBelow:
|
||||
{
|
||||
StackingUpdatesBlocker blocker( workspace());
|
||||
if( keepAbove())
|
||||
setKeepAbove( false );
|
||||
else
|
||||
setKeepBelow( true );
|
||||
break;
|
||||
}
|
||||
case Options::MousePreviousDesktop:
|
||||
workspace()->windowToPreviousDesktop( this );
|
||||
break;
|
||||
case Options::MouseNextDesktop:
|
||||
workspace()->windowToNextDesktop( this );
|
||||
break;
|
||||
case Options::MouseOpacityMore:
|
||||
if (opacity_ < 0xFFFFFFFF)
|
||||
{
|
||||
if (opacity_ < 0xF3333333)
|
||||
{
|
||||
setOpacity(TRUE, opacity_ + 0xCCCCCCC);
|
||||
custom_opacity = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
setOpacity(FALSE, 0xFFFFFFFF);
|
||||
custom_opacity = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Options::MouseOpacityLess:
|
||||
if (opacity_ > 0)
|
||||
{
|
||||
setOpacity(TRUE, (opacity_ > 0xCCCCCCC) ? opacity_ - 0xCCCCCCC : 0);
|
||||
custom_opacity = true;
|
||||
}
|
||||
break;
|
||||
case Options::MouseNothing:
|
||||
// fall through
|
||||
default:
|
||||
replay = TRUE;
|
||||
break;
|
||||
}
|
||||
|
@ -757,11 +819,15 @@ void Workspace::slotSetupWindowShortcut()
|
|||
Move window to next desktop
|
||||
*/
|
||||
void Workspace::slotWindowToNextDesktop()
|
||||
{
|
||||
windowToNextDesktop( active_popup_client ? active_popup_client : active_client );
|
||||
}
|
||||
|
||||
void Workspace::windowToNextDesktop( Client* c )
|
||||
{
|
||||
int d = currentDesktop() + 1;
|
||||
if ( d > numberOfDesktops() )
|
||||
d = 1;
|
||||
Client* c = active_popup_client ? active_popup_client : active_client;
|
||||
if (c && !c->isDesktop()
|
||||
&& !c->isDock() && !c->isTopMenu())
|
||||
{
|
||||
|
@ -775,11 +841,15 @@ void Workspace::slotWindowToNextDesktop()
|
|||
Move window to previous desktop
|
||||
*/
|
||||
void Workspace::slotWindowToPreviousDesktop()
|
||||
{
|
||||
windowToPreviousDesktop( active_popup_client ? active_popup_client : active_client );
|
||||
}
|
||||
|
||||
void Workspace::windowToPreviousDesktop( Client* c )
|
||||
{
|
||||
int d = currentDesktop() - 1;
|
||||
if ( d <= 0 )
|
||||
d = numberOfDesktops();
|
||||
Client* c = active_popup_client ? active_popup_client : active_client;
|
||||
if (c && !c->isDesktop()
|
||||
&& !c->isDock() && !c->isTopMenu())
|
||||
{
|
||||
|
|
|
@ -183,6 +183,8 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine
|
|||
Client* topClientOnDesktop( int desktop, bool unconstrained = false ) const;
|
||||
Client* findDesktop( bool topmost, int desktop ) const;
|
||||
void sendClientToDesktop( Client* c, int desktop, bool dont_activate );
|
||||
void windowToPreviousDesktop( Client* c );
|
||||
void windowToNextDesktop( Client* c );
|
||||
|
||||
// KDE4 remove me - and it's also in the DCOP interface :(
|
||||
void showWindowMenuAt( unsigned long id, int x, int y );
|
||||
|
|
Loading…
Reference in a new issue