Take care of #46042. [...resisted to say here something about Motif >;> ]
svn path=/trunk/kdebase/kwin/; revision=174310
This commit is contained in:
parent
9edf8b7563
commit
3b57952b03
17 changed files with 130 additions and 27 deletions
client.cppclient.hworkspace.cppworkspace.h
clients
b2
default
icewm
keramik
kstep
kwmtheme
laptop
modernsystem
quartz
redmond
riscos
system
web
45
client.cpp
45
client.cpp
|
@ -518,6 +518,10 @@ Client::Client( Workspace *ws, WId w, QWidget *parent, const char *name, WFlags
|
||||||
stays_on_top = FALSE;
|
stays_on_top = FALSE;
|
||||||
is_shape = FALSE;
|
is_shape = FALSE;
|
||||||
may_move = TRUE;
|
may_move = TRUE;
|
||||||
|
may_resize = TRUE;
|
||||||
|
may_minimize = TRUE;
|
||||||
|
may_maximize = TRUE;
|
||||||
|
may_close = TRUE;
|
||||||
is_fullscreen = FALSE;
|
is_fullscreen = FALSE;
|
||||||
skip_taskbar = FALSE;
|
skip_taskbar = FALSE;
|
||||||
|
|
||||||
|
@ -535,6 +539,15 @@ Client::Client( Workspace *ws, WId w, QWidget *parent, const char *name, WFlags
|
||||||
|
|
||||||
cmap = None;
|
cmap = None;
|
||||||
|
|
||||||
|
bool mresize, mmove, mminimize, mmaximize, mclose;
|
||||||
|
if( Motif::funcFlags( win, mresize, mmove, mminimize, mmaximize, mclose )) {
|
||||||
|
may_resize = mresize;
|
||||||
|
may_move = mmove;
|
||||||
|
may_minimize = mminimize;
|
||||||
|
may_maximize = mmaximize;
|
||||||
|
may_close = mclose;
|
||||||
|
}
|
||||||
|
|
||||||
Window ww;
|
Window ww;
|
||||||
if ( !XGetTransientForHint( qt_xdisplay(), (Window) win, &ww ) )
|
if ( !XGetTransientForHint( qt_xdisplay(), (Window) win, &ww ) )
|
||||||
transient_for = None;
|
transient_for = None;
|
||||||
|
@ -641,12 +654,20 @@ bool Client::manage( bool isMapped, bool doNotShow, bool isInitial )
|
||||||
if ( !stays_on_top )
|
if ( !stays_on_top )
|
||||||
is_fullscreen = TRUE;
|
is_fullscreen = TRUE;
|
||||||
may_move = FALSE; // don't let fullscreen windows be moved around
|
may_move = FALSE; // don't let fullscreen windows be moved around
|
||||||
|
may_resize = FALSE;
|
||||||
|
may_minimize = FALSE;
|
||||||
|
may_maximize = FALSE;
|
||||||
|
may_close = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isDesktop() ) {
|
if ( isDesktop() ) {
|
||||||
// desktops are treated slightly special
|
// desktops are treated slightly special
|
||||||
geom = workspace()->geometry();
|
geom = workspace()->geometry();
|
||||||
may_move = FALSE;
|
may_move = FALSE;
|
||||||
|
may_resize = FALSE;
|
||||||
|
may_minimize = FALSE;
|
||||||
|
may_maximize = FALSE;
|
||||||
|
may_close = FALSE;
|
||||||
isMapped = TRUE;
|
isMapped = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1462,7 +1483,7 @@ QSize Client::sizeForWindowSize( const QSize& wsize, bool ignore_height) const
|
||||||
*/
|
*/
|
||||||
bool Client::isResizable() const
|
bool Client::isResizable() const
|
||||||
{
|
{
|
||||||
if ( !isMovable() )
|
if ( !isMovable() || !may_resize )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if ( ( xSizeHint.flags & PMaxSize) == 0 || (xSizeHint.flags & PMinSize ) == 0 )
|
if ( ( xSizeHint.flags & PMaxSize) == 0 || (xSizeHint.flags & PMinSize ) == 0 )
|
||||||
|
@ -1478,7 +1499,7 @@ bool Client::isMaximizable() const
|
||||||
{
|
{
|
||||||
if ( isMaximized() )
|
if ( isMaximized() )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return isResizable() && !isTool();
|
return isResizable() && !isTool() && may_maximize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1487,7 +1508,16 @@ bool Client::isMaximizable() const
|
||||||
bool Client::isMinimizable() const
|
bool Client::isMinimizable() const
|
||||||
{
|
{
|
||||||
return ( !isTransient() || !workspace()->findClient( transientFor() ) )
|
return ( !isTransient() || !workspace()->findClient( transientFor() ) )
|
||||||
&& wantsTabFocus();
|
&& wantsTabFocus() && may_minimize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Returns whether the window may be closed (have a close button)
|
||||||
|
*/
|
||||||
|
bool Client::isCloseable() const
|
||||||
|
{
|
||||||
|
return may_close && !isDesktop() && !isDock() && !isTopMenu() && !isToolbar()
|
||||||
|
&& windowType() != NET::Override;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1909,6 +1939,8 @@ void Client::iconify()
|
||||||
*/
|
*/
|
||||||
void Client::closeWindow()
|
void Client::closeWindow()
|
||||||
{
|
{
|
||||||
|
if( !isCloseable())
|
||||||
|
return;
|
||||||
Events::raise( Events::Close );
|
Events::raise( Events::Close );
|
||||||
if ( Pdeletewindow ){
|
if ( Pdeletewindow ){
|
||||||
sendClientMessage( win, atoms->wm_protocols, atoms->wm_delete_window);
|
sendClientMessage( win, atoms->wm_protocols, atoms->wm_delete_window);
|
||||||
|
@ -2987,11 +3019,16 @@ bool Client::isTopMenu() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Client::isTool() const
|
bool Client::isToolbar() const
|
||||||
{
|
{
|
||||||
return windowType() == NET::Tool;
|
return windowType() == NET::Tool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Client::isTool() const
|
||||||
|
{
|
||||||
|
return isToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
8
client.h
8
client.h
|
@ -154,10 +154,12 @@ public:
|
||||||
bool isMovable() const;
|
bool isMovable() const;
|
||||||
bool isDesktop() const;
|
bool isDesktop() const;
|
||||||
bool isDock() const;
|
bool isDock() const;
|
||||||
bool isTool() const;
|
bool isTool() const; // KDE4 remove me
|
||||||
|
bool isToolbar() const;
|
||||||
bool isTopMenu() const;
|
bool isTopMenu() const;
|
||||||
|
|
||||||
bool isResizable() const;
|
bool isResizable() const;
|
||||||
|
bool isCloseable() const; // may have a close button
|
||||||
|
|
||||||
void takeFocus( bool force = FALSE );
|
void takeFocus( bool force = FALSE );
|
||||||
|
|
||||||
|
@ -323,6 +325,10 @@ private:
|
||||||
uint input :1; // does the window want input in its wm_hints
|
uint input :1; // does the window want input in its wm_hints
|
||||||
uint store_settings : 1;
|
uint store_settings : 1;
|
||||||
uint skip_pager : 1;
|
uint skip_pager : 1;
|
||||||
|
uint may_resize : 1;
|
||||||
|
uint may_maximize : 1;
|
||||||
|
uint may_minimize : 1;
|
||||||
|
uint may_close : 1;
|
||||||
void getWMHints();
|
void getWMHints();
|
||||||
void getWindowProtocols();
|
void getWindowProtocols();
|
||||||
QPixmap icon_pix;
|
QPixmap icon_pix;
|
||||||
|
|
|
@ -495,7 +495,7 @@ void B2Client::addButtons(const QString& s, const QString tips[],
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'X': // Close button
|
case 'X': // Close button
|
||||||
if (!button[BtnClose]) {
|
if (isCloseable() && !button[BtnClose]) {
|
||||||
button[BtnClose]= new B2Button(this, tb, tips[BtnClose]);
|
button[BtnClose]= new B2Button(this, tb, tips[BtnClose]);
|
||||||
button[BtnClose]->setPixmaps(P_CLOSE);
|
button[BtnClose]->setPixmaps(P_CLOSE);
|
||||||
connect(button[BtnClose], SIGNAL(clicked()),
|
connect(button[BtnClose], SIGNAL(clicked()),
|
||||||
|
|
|
@ -723,7 +723,7 @@ void KDEDefaultClient::addClientButtons( const QString& s, bool isLeft )
|
||||||
|
|
||||||
// Close button
|
// Close button
|
||||||
case 'X':
|
case 'X':
|
||||||
if (!button[BtnClose])
|
if (!button[BtnClose] && isCloseable())
|
||||||
{
|
{
|
||||||
button[BtnClose] = new KDEDefaultButton(this, "close",
|
button[BtnClose] = new KDEDefaultButton(this, "close",
|
||||||
largeButtons, isLeft, true, close_bits,
|
largeButtons, isLeft, true, close_bits,
|
||||||
|
|
|
@ -815,7 +815,7 @@ void IceWMClient::addClientButtons( const QString& s )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'x':
|
case 'x':
|
||||||
if ( validPixmaps(closePix) && !button[BtnClose] )
|
if ( validPixmaps(closePix) && !button[BtnClose] && isCloseable())
|
||||||
{
|
{
|
||||||
button[BtnClose] = new IceWMButton(this, "close",
|
button[BtnClose] = new IceWMButton(this, "close",
|
||||||
&closePix, false, i18n("Close"));
|
&closePix, false, i18n("Close"));
|
||||||
|
|
|
@ -866,7 +866,7 @@ void KeramikClient::addButtons( QBoxLayout *layout, const QString &s )
|
||||||
|
|
||||||
// Close button
|
// Close button
|
||||||
case 'X' :
|
case 'X' :
|
||||||
if ( !button[CloseButton] ) {
|
if ( !button[CloseButton] && isCloseable() ) {
|
||||||
button[CloseButton] = new KeramikButton( this, "close", CloseButton, i18n("Close") );
|
button[CloseButton] = new KeramikButton( this, "close", CloseButton, i18n("Close") );
|
||||||
connect( button[CloseButton], SIGNAL( clicked() ), SLOT( closeWindow() ) );
|
connect( button[CloseButton], SIGNAL( clicked() ), SLOT( closeWindow() ) );
|
||||||
layout->addWidget( button[CloseButton] );
|
layout->addWidget( button[CloseButton] );
|
||||||
|
|
|
@ -392,12 +392,14 @@ void NextClient::addButtons(QBoxLayout* titleLayout, const QString& spec)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'X':
|
case 'X':
|
||||||
|
if( isCloseable()) {
|
||||||
button[CLOSE_IDX] =
|
button[CLOSE_IDX] =
|
||||||
new NextButton(this, "close", close_bits, 10, 10,
|
new NextButton(this, "close", close_bits, 10, 10,
|
||||||
i18n("Close"));
|
i18n("Close"));
|
||||||
titleLayout->addWidget( button[CLOSE_IDX] );
|
titleLayout->addWidget( button[CLOSE_IDX] );
|
||||||
connect( button[CLOSE_IDX], SIGNAL(clicked()),
|
connect( button[CLOSE_IDX], SIGNAL(clicked()),
|
||||||
this, SLOT(closeWindow()) );
|
this, SLOT(closeWindow()) );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '_':
|
case '_':
|
||||||
|
|
|
@ -317,7 +317,7 @@ KWMThemeClient::KWMThemeClient( Workspace *ws, WId w, QWidget *parent,
|
||||||
hb->addWidget(maxBtn);
|
hb->addWidget(maxBtn);
|
||||||
maxBtn->setFixedSize(20, 20);
|
maxBtn->setFixedSize(20, 20);
|
||||||
}
|
}
|
||||||
else if(val == "Close"){
|
else if((val == "Close") && isCloseable()){
|
||||||
btn = new MyButton(this, "close", i18n("Close"));
|
btn = new MyButton(this, "close", i18n("Close"));
|
||||||
btn->setPixmap(*closePix);
|
btn->setPixmap(*closePix);
|
||||||
connect(btn, SIGNAL(clicked()), this, SLOT(closeWindow()));
|
connect(btn, SIGNAL(clicked()), this, SLOT(closeWindow()));
|
||||||
|
|
|
@ -370,6 +370,8 @@ LaptopClient::LaptopClient( Workspace *ws, WId w, QWidget *parent,
|
||||||
button[BtnIconify]->hide();
|
button[BtnIconify]->hide();
|
||||||
if ( !isMaximizable() )
|
if ( !isMaximizable() )
|
||||||
button[BtnMax]->hide();
|
button[BtnMax]->hide();
|
||||||
|
if ( !isCloseable() )
|
||||||
|
button[BtnClose]->hide();
|
||||||
|
|
||||||
hiddenItems = false;
|
hiddenItems = false;
|
||||||
bufferDirty = true;
|
bufferDirty = true;
|
||||||
|
|
|
@ -336,7 +336,7 @@ ModernSys::ModernSys( Workspace *ws, WId w, QWidget *parent,
|
||||||
hb->addSpacing(int(c - '0'));
|
hb->addSpacing(int(c - '0'));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (c == 'X') {
|
else if (c == 'X' && isCloseable()) {
|
||||||
hb->addWidget(button[BtnClose]);
|
hb->addWidget(button[BtnClose]);
|
||||||
button[BtnClose]->show();
|
button[BtnClose]->show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -533,7 +533,7 @@ void QuartzClient::addClientButtons( const QString& s, bool isLeft )
|
||||||
|
|
||||||
// Close button
|
// Close button
|
||||||
case 'X':
|
case 'X':
|
||||||
if (!button[BtnClose])
|
if (!button[BtnClose] && isCloseable())
|
||||||
{
|
{
|
||||||
button[BtnClose] = new QuartzButton(this, "close",
|
button[BtnClose] = new QuartzButton(this, "close",
|
||||||
largeButtons, isLeft, true, close_bits, i18n("Close"));
|
largeButtons, isLeft, true, close_bits, i18n("Close"));
|
||||||
|
|
|
@ -445,6 +445,8 @@ GalliumClient::GalliumClient( Workspace *ws, WId w, QWidget *parent,
|
||||||
button[BtnIconify]->hide();
|
button[BtnIconify]->hide();
|
||||||
if ( !isMaximizable() )
|
if ( !isMaximizable() )
|
||||||
button[BtnMax]->hide();
|
button[BtnMax]->hide();
|
||||||
|
if ( !isCloseable() )
|
||||||
|
button[BtnClose]->hide();
|
||||||
|
|
||||||
hiddenItems = false;
|
hiddenItems = false;
|
||||||
|
|
||||||
|
|
|
@ -702,7 +702,10 @@ Manager::createButton(int type, QWidget * parent)
|
||||||
|
|
||||||
case Button::Close:
|
case Button::Close:
|
||||||
|
|
||||||
b = new CloseButton(parent);
|
if (isCloseable())
|
||||||
|
{
|
||||||
|
b = new CloseButton(parent);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -337,7 +337,11 @@ SystemClient::SystemClient( Workspace *ws, WId w, QWidget *parent,
|
||||||
hb->setResizeMode(QLayout::FreeResize);
|
hb->setResizeMode(QLayout::FreeResize);
|
||||||
g->addLayout( hb, 0, 1 );
|
g->addLayout( hb, 0, 1 );
|
||||||
hb->addSpacing(3);
|
hb->addSpacing(3);
|
||||||
hb->addWidget( button[0]);
|
if (isCloseable()) {
|
||||||
|
hb->addWidget( button[0]);
|
||||||
|
} else
|
||||||
|
button[0]->hide();
|
||||||
|
|
||||||
titlebar = new QSpacerItem(10, 14, QSizePolicy::Expanding,
|
titlebar = new QSpacerItem(10, 14, QSizePolicy::Expanding,
|
||||||
QSizePolicy::Minimum);
|
QSizePolicy::Minimum);
|
||||||
hb->addSpacing(3);
|
hb->addSpacing(3);
|
||||||
|
|
|
@ -354,7 +354,7 @@ WebClient::_createButton(const QString & s, QWidget * parent)
|
||||||
connect(this, SIGNAL(maxChange(bool)), b, SLOT(slotMaximizeChange(bool)));
|
connect(this, SIGNAL(maxChange(bool)), b, SLOT(slotMaximizeChange(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ("Close" == s)
|
else if ("Close" == s && isCloseable())
|
||||||
{
|
{
|
||||||
b = new WebButtonClose(parent);
|
b = new WebButtonClose(parent);
|
||||||
connect(b, SIGNAL(closeWindow()), this, SLOT(closeWindow()));
|
connect(b, SIGNAL(closeWindow()), this, SLOT(closeWindow()));
|
||||||
|
|
|
@ -179,13 +179,6 @@ int Shape::shapeEvent()
|
||||||
|
|
||||||
bool Motif::noBorder( WId w )
|
bool Motif::noBorder( WId w )
|
||||||
{
|
{
|
||||||
struct MwmHints {
|
|
||||||
ulong flags;
|
|
||||||
ulong functions;
|
|
||||||
ulong decorations;
|
|
||||||
long input_mode;
|
|
||||||
ulong status;
|
|
||||||
};
|
|
||||||
Atom type;
|
Atom type;
|
||||||
int format;
|
int format;
|
||||||
unsigned long length, after;
|
unsigned long length, after;
|
||||||
|
@ -199,7 +192,7 @@ bool Motif::noBorder( WId w )
|
||||||
}
|
}
|
||||||
bool result = FALSE;
|
bool result = FALSE;
|
||||||
if ( hints ) {
|
if ( hints ) {
|
||||||
if ( hints->flags & (1L << 1 ) ) { // // MWM_HINTS_DECORATIONS;
|
if ( hints->flags & MWM_HINTS_DECORATIONS ) {
|
||||||
if ( hints->decorations == 0 )
|
if ( hints->decorations == 0 )
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -208,8 +201,43 @@ bool Motif::noBorder( WId w )
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Motif::funcFlags( WId w, bool& resize, bool& move, bool& minimize,
|
||||||
|
bool& maximize, bool& close )
|
||||||
|
{
|
||||||
|
Atom type;
|
||||||
|
int format;
|
||||||
|
unsigned long length, after;
|
||||||
|
unsigned char* data;
|
||||||
|
MwmHints* hints = 0;
|
||||||
|
if ( XGetWindowProperty( qt_xdisplay(), w, atoms->motif_wm_hints, 0, 5,
|
||||||
|
FALSE, atoms->motif_wm_hints, &type, &format,
|
||||||
|
&length, &after, &data ) == Success ) {
|
||||||
|
if ( data )
|
||||||
|
hints = (MwmHints*) data;
|
||||||
|
}
|
||||||
|
if ( hints ) {
|
||||||
|
// To quote from Metacity 'We support those MWM hints deemed non-stupid'
|
||||||
|
if ( hints->flags & MWM_HINTS_FUNCTIONS ) {
|
||||||
|
// if MWM_FUNC_ALL is set, other flags say what to turn _off_
|
||||||
|
bool set_value = (( hints->functions & MWM_FUNC_ALL ) == 0 );
|
||||||
|
resize = move = minimize = maximize = close = !set_value;
|
||||||
|
if( hints->functions & MWM_FUNC_RESIZE )
|
||||||
|
resize = set_value;
|
||||||
|
if( hints->functions & MWM_FUNC_MOVE )
|
||||||
|
move = set_value;
|
||||||
|
if( hints->functions & MWM_FUNC_MINIMIZE )
|
||||||
|
minimize = set_value;
|
||||||
|
if( hints->functions & MWM_FUNC_MAXIMIZE )
|
||||||
|
maximize = set_value;
|
||||||
|
if( hints->functions & MWM_FUNC_CLOSE )
|
||||||
|
close = set_value;
|
||||||
|
XFree( data );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
XFree( data );
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Creates a new client for window \a w, depending on certain hints
|
Creates a new client for window \a w, depending on certain hints
|
||||||
|
@ -397,7 +425,6 @@ void Workspace::init()
|
||||||
NET::CloseWindow |
|
NET::CloseWindow |
|
||||||
NET::DesktopNames |
|
NET::DesktopNames |
|
||||||
NET::KDESystemTrayWindows |
|
NET::KDESystemTrayWindows |
|
||||||
NET::CloseWindow |
|
|
||||||
NET::WMName |
|
NET::WMName |
|
||||||
NET::WMVisibleName |
|
NET::WMVisibleName |
|
||||||
NET::WMDesktop |
|
NET::WMDesktop |
|
||||||
|
@ -2949,6 +2976,7 @@ void Workspace::clientPopupAboutToShow()
|
||||||
popup->setItemEnabled( Options::IconifyOp, active_client->isMinimizable() );
|
popup->setItemEnabled( Options::IconifyOp, active_client->isMinimizable() );
|
||||||
popup->setItemEnabled( Options::ToggleStoreSettingsOp, !active_client->isTransient() );
|
popup->setItemEnabled( Options::ToggleStoreSettingsOp, !active_client->isTransient() );
|
||||||
popup->setItemChecked( Options::ToggleStoreSettingsOp, active_client->storeSettings() );
|
popup->setItemChecked( Options::ToggleStoreSettingsOp, active_client->storeSettings() );
|
||||||
|
popup->setItemChecked( Options::CloseOp, active_client->isCloseable() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
19
workspace.h
19
workspace.h
|
@ -89,6 +89,25 @@ public:
|
||||||
class Motif {
|
class Motif {
|
||||||
public:
|
public:
|
||||||
static bool noBorder( WId w );
|
static bool noBorder( WId w );
|
||||||
|
static bool funcFlags( WId w, bool& resize, bool& move, bool& minimize,
|
||||||
|
bool& maximize, bool& close );
|
||||||
|
struct MwmHints {
|
||||||
|
ulong flags;
|
||||||
|
ulong functions;
|
||||||
|
ulong decorations;
|
||||||
|
long input_mode;
|
||||||
|
ulong status;
|
||||||
|
};
|
||||||
|
enum { MWM_HINTS_FUNCTIONS = (1L << 0),
|
||||||
|
MWM_HINTS_DECORATIONS = (1L << 1),
|
||||||
|
|
||||||
|
MWM_FUNC_ALL = (1L << 0),
|
||||||
|
MWM_FUNC_RESIZE = (1L << 1),
|
||||||
|
MWM_FUNC_MOVE = (1L << 2),
|
||||||
|
MWM_FUNC_MINIMIZE = (1L << 3),
|
||||||
|
MWM_FUNC_MAXIMIZE = (1L << 4),
|
||||||
|
MWM_FUNC_CLOSE = (1L << 5)
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class WorkspacePrivate;
|
class WorkspacePrivate;
|
||||||
|
|
Loading…
Reference in a new issue