mac menubar

svn path=/trunk/kdebase/kwin/; revision=55967
This commit is contained in:
Matthias Ettrich 2000-07-10 15:54:17 +00:00
parent 9f2a4f3dc4
commit 05a8a4fde3
3 changed files with 46 additions and 3 deletions

View file

@ -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.

View file

@ -125,6 +125,7 @@ public:
bool isMovable() const;
bool isDesktop() const;
bool isDock() const;
bool isMenu() const;
void takeFocus();

View file

@ -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 );
}