mac menubar
svn path=/trunk/kdebase/kwin/; revision=55967
This commit is contained in:
parent
9f2a4f3dc4
commit
05a8a4fde3
3 changed files with 46 additions and 3 deletions
13
client.cpp
13
client.cpp
|
@ -1599,14 +1599,14 @@ bool Client::x11Event( XEvent * e)
|
|||
if ( options->focusPolicy == Options::ClickToFocus )
|
||||
return TRUE;
|
||||
|
||||
if ( options->autoRaise && !isDesktop() && !isDock() ) {
|
||||
if ( options->autoRaise && !isDesktop() && !isDock() && !isMenu() ) {
|
||||
delete autoRaiseTimer;
|
||||
autoRaiseTimer = new QTimer( this );
|
||||
connect( autoRaiseTimer, SIGNAL( timeout() ), this, SLOT( autoRaise() ) );
|
||||
autoRaiseTimer->start( options->autoRaiseInterval, TRUE );
|
||||
}
|
||||
|
||||
if ( options->focusPolicy != Options::FocusStrictlyUnderMouse && ( isDesktop() || isDock() ) )
|
||||
if ( options->focusPolicy != Options::FocusStrictlyUnderMouse && ( isDesktop() || isDock() || isMenu() ) )
|
||||
return TRUE;
|
||||
|
||||
workspace()->requestFocus( this );
|
||||
|
@ -1875,6 +1875,9 @@ void Client::getWindowProtocols(){
|
|||
*/
|
||||
void Client::takeFocus()
|
||||
{
|
||||
if ( isMenu() )
|
||||
return; // menus don't take focus
|
||||
|
||||
if ( input )
|
||||
XSetInputFocus( qt_xdisplay(), win, RevertToPointerRoot, kwin_time );
|
||||
if ( Ptakefocus )
|
||||
|
@ -2216,6 +2219,12 @@ bool Client::isDock() const
|
|||
return windowType() == NET::Dock;
|
||||
}
|
||||
|
||||
bool Client::isMenu() const
|
||||
{
|
||||
return windowType() == NET::Menu;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
Returns \a area with the client's strut taken into account.
|
||||
|
|
1
client.h
1
client.h
|
@ -125,6 +125,7 @@ public:
|
|||
bool isMovable() const;
|
||||
bool isDesktop() const;
|
||||
bool isDock() const;
|
||||
bool isMenu() const;
|
||||
|
||||
void takeFocus();
|
||||
|
||||
|
|
|
@ -851,7 +851,7 @@ Client* Workspace::previousStaticClient( Client* c ) const
|
|||
Client* Workspace::topClientOnDesktop() const
|
||||
{
|
||||
for ( ClientList::ConstIterator it = stacking_order.fromLast(); it != stacking_order.end(); --it) {
|
||||
if ( !(*it)->isDesktop() && !(*it)->isDock() )
|
||||
if ( !(*it)->isDesktop() && !(*it)->isDock() && !(*it)->isDock() )
|
||||
return *it;
|
||||
}
|
||||
return 0;
|
||||
|
@ -912,6 +912,39 @@ void Workspace::setActiveClient( Client* c )
|
|||
if ( c->wantsTabFocus() )
|
||||
focus_chain.append( c );
|
||||
}
|
||||
|
||||
// toplevel menubar handling
|
||||
Client* main = 0;
|
||||
if ( active_client )
|
||||
main = active_client->mainClient();
|
||||
|
||||
// show the new menu bar first...
|
||||
Client* menubar = 0;
|
||||
for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it) {
|
||||
if ( (*it)->isMenu() && (*it)->mainClient() == main ) {
|
||||
menubar = *it;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( !menubar && desktop_client ) {
|
||||
for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it) {
|
||||
if ( (*it)->isMenu() && (*it)->mainClient() == desktop_client ) {
|
||||
menubar = *it;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( menubar ) {
|
||||
menubar->show();
|
||||
menubar->raise();
|
||||
}
|
||||
|
||||
// ... then hide the other ones. Avoids flickers.
|
||||
for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it) {
|
||||
if ( (*it)->isMenu() && (*it) != menubar )
|
||||
(*it)->hide();
|
||||
}
|
||||
|
||||
rootInfo->setActiveWindow( active_client? active_client->window() : 0 );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue