Re: How to prevent a new window to get the window manager focus



On Tue, 2002-04-30 at 03:40, Havoc Pennington wrote:

Joaquín Cuenca Abela <cuenca pacaterie u-psud fr> writes:
cf. subject.

I have a program that creates a new window, but I want to prevent the
window manager from focusing the new created window.

Anybody knows how to do that without running in race conditions, and
being wm independent?

I don't think it's possible, even if you mark the window not focusable
(which requires deep unsupported GDK hackery and direct Xlib use to
change the "input" flag in WM_HINTS I think), Sawfish for example has
a "give focus to windows that haven't asked for it" option.

too bad.

<irony>
Maybe we can have an option named "don't give focus to windows, even if
the window manager thinks it has to give the focus even if elsewhere we
said that we didn't want the focus."
</irony>

You don't have to read it in a row...

Btw, yes, I have a good reason.  That's not a "keep consistency with
other apps and let the wm decide" kind of question.

Is the reason something other people will encounter? If so perhaps
this should be added to the WM spec.

Maybe.  Not very common, but possible.

What I'm trying to do is to simulate the look of gtk menus using
toplevel windows.

Why?  I'm doing it for a menu editor in glade.  In the menu editor I
have a GtkEntry by menu item.

If I try to put the GtkEntry directly in a gtk+ menu it will not work,
because the menus are popup windows, and thus the wm doesn't "knows"
about them, and thus it doesn't give them the focus, and thus the user
can not type in the GtkEntry.

In addition what I'm looking for is not exactly a gtk menu with
GtkEntries embedded.  My menus should be a bit more "persistent" than
gtk+ menus.  Say that the user starts building its menu, and he want to
go to the glade's main window, save the project and keep working in the
menu.  IMO the menu should remain opened, and of course that's
impossible with the gtk+ menu.

So I started working in a menu composed of non-decorated toplevel
windows.  When the user clicks in an menu item, the item becomes an
entry, and a new "submenu" pops up next to the selected menu item.  In
the beginning, this submenu is empty, and the user can create new menu
items in this submenu if he wants to do it.

*But*, when the user clicks in menu item, the focus should remain in the
main menu and should not go to the submenu, because the usual action is
to change the text of the menu item, and not to create a new submenu.

Thus I want the new window to not get the focus.

Well, it's a bit hard to explain it, but I hope you've got the idea.

IMO if we're free to ask the WM to not decorate some windows, we should
also be free to control in a finer-grained way how the focus goes and
comes.

So, what's the usual procedure to get something added to the WM spec?

Cheers,

-- 
Joaquín Cuenca Abela
cuenca pacaterie u-psud fr




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]