no "resize" and "maximize" options for non-resizable windows
svn path=/trunk/kdebase/kwin/; revision=56608
This commit is contained in:
parent
32bde0d550
commit
5fb81f837b
4 changed files with 28 additions and 13 deletions
14
client.cpp
14
client.cpp
|
@ -1022,6 +1022,18 @@ QSize Client::sizeForWindowSize( const QSize& wsize, bool ignore_height) const
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
Returns whether the window is resizable or has a fixed size.
|
||||
*/
|
||||
bool Client::isResizable() const
|
||||
{
|
||||
if ( ( xSizeHint.flags & PMaxSize) == 0 || (xSizeHint.flags & PMinSize ) == 0 )
|
||||
return TRUE;
|
||||
return ( xSizeHint.min_width != xSizeHint.max_width ) ||
|
||||
( xSizeHint.min_height != xSizeHint.max_height );
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Reimplemented to provide move/resize
|
||||
*/
|
||||
|
@ -1446,7 +1458,7 @@ void Client::killWindow()
|
|||
|
||||
void Client::maximize( MaximizeMode m)
|
||||
{
|
||||
if (!isMovable())
|
||||
if (!isMovable() || !isResizable() )
|
||||
return;
|
||||
|
||||
QRect clientArea = workspace()->clientArea();
|
||||
|
|
2
client.h
2
client.h
|
@ -126,6 +126,8 @@ public:
|
|||
bool isDesktop() const;
|
||||
bool isDock() const;
|
||||
bool isMenu() const;
|
||||
|
||||
bool isResizable() const;
|
||||
|
||||
void takeFocus();
|
||||
|
||||
|
|
4
main.cpp
4
main.cpp
|
@ -46,7 +46,7 @@ static void crashHandler(int)
|
|||
{
|
||||
KCrash::setCrashHandler(0); // Exit on next crash.
|
||||
delete client; client = 0; // Unregister with dcop.
|
||||
system("kwin&"); // Try to restart
|
||||
// system("kwin&"); // Try to restart
|
||||
}
|
||||
|
||||
int x11ErrorHandler(Display *d, XErrorEvent *e){
|
||||
|
@ -214,7 +214,7 @@ int main( int argc, char * argv[] )
|
|||
signal(SIGHUP, SIG_IGN);
|
||||
|
||||
Application a;
|
||||
KCrash::setCrashHandler(crashHandler); // Try to restart on crash
|
||||
// KCrash::setCrashHandler(crashHandler); // Try to restart on crash
|
||||
fcntl(ConnectionNumber(qt_xdisplay()), F_SETFD, 1);
|
||||
|
||||
client = a.dcopClient();
|
||||
|
|
|
@ -844,13 +844,13 @@ Client* Workspace::previousStaticClient( Client* c ) const
|
|||
|
||||
|
||||
/*!
|
||||
Returns topmost visible client. Windows on the dock and the
|
||||
desktop are excluded.
|
||||
Returns topmost visible client. Windows on the dock, the desktop
|
||||
or of any other special kind are excluded.
|
||||
*/
|
||||
Client* Workspace::topClientOnDesktop() const
|
||||
{
|
||||
for ( ClientList::ConstIterator it = stacking_order.fromLast(); it != stacking_order.end(); --it) {
|
||||
if ( !(*it)->isDesktop() && !(*it)->isDock() && !(*it)->isDock() )
|
||||
if ( !(*it)->isDesktop() && (*it)->isVisible() && (*it)->wantsTabFocus() )
|
||||
return *it;
|
||||
}
|
||||
return 0;
|
||||
|
@ -1528,18 +1528,19 @@ void Workspace::lowerClient( Client* c, bool dropFocus )
|
|||
ClientList list = constrainedStackingOrder( stacking_order );
|
||||
Window* new_stack = new Window[ list.count() + 1 ];
|
||||
int i = 0;
|
||||
Client *new_top = 0;
|
||||
for ( ClientList::ConstIterator it = list.fromLast(); it != list.end(); --it) {
|
||||
new_stack[i++] = (*it)->winId();
|
||||
if (!new_top && (*it)->isVisible()) new_top = (*it);
|
||||
}
|
||||
XRaiseWindow(qt_xdisplay(), new_stack[0]);
|
||||
XRestackWindows(qt_xdisplay(), new_stack, i);
|
||||
delete [] new_stack;
|
||||
|
||||
propagateClients( TRUE );
|
||||
if (dropFocus && new_top) {
|
||||
requestFocus(new_top);
|
||||
|
||||
if (dropFocus ) {
|
||||
Client* top = topClientOnDesktop();
|
||||
if ( top )
|
||||
requestFocus( top);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2101,6 +2102,8 @@ void Workspace::clientPopupAboutToShow()
|
|||
{
|
||||
if ( !popup_client || !popup )
|
||||
return;
|
||||
popup->setItemEnabled( Options::ResizeOp, popup_client->isResizable() );
|
||||
popup->setItemEnabled( Options::MaximizeOp, popup_client->isResizable() );
|
||||
popup->setItemChecked( Options::MaximizeOp, popup_client->isMaximized() );
|
||||
popup->setItemChecked( Options::ShadeOp, popup_client->isShade() );
|
||||
popup->setItemChecked( Options::StaysOnTopOp, popup_client->staysOnTop() );
|
||||
|
@ -2642,9 +2645,7 @@ void Workspace::loadDesktopSettings()
|
|||
{
|
||||
KConfig c("kdeglobals");
|
||||
c.setGroup("Desktops");
|
||||
if (!c.hasKey("Number"))
|
||||
c.writeEntry("Number", 4);
|
||||
int n = c.readNumEntry("Number");
|
||||
int n = c.readNumEntry("Number", 4);
|
||||
number_of_desktops = n;
|
||||
rootInfo->setNumberOfDesktops( number_of_desktops );
|
||||
for(int i = 1; i <= n; i++) {
|
||||
|
|
Loading…
Reference in a new issue