Tony Mechelynck wrote:
> On 21/01/09 18:13, Paul Egan wrote:
>> Attached is a patch which adds a "raise" option to the --remote
>> arguments. Use of this option requests the window manager to
>> raise the remote server window into focus and explicitly
>> moves it to the current desktop if required.
>>
>> My first attempt at this functionality was to use a --remote-send
>> ":call foreground()<CR>", however most window managers (or the
>> versions patched by Fedora, Ubuntu, etc) will ignore the
>> resulting gtk_window_present call - or at least just "pulse" the
>> window list item - which isn't very useful.
>>
>> There's a long running debate about the correct actions that
>> should be taken for gtk_window_present and _NET_ACTIVE_WINDOW,
>> with each app and wm having a slightly different take. It could
>> be argued that the "issue" this patch fixes should really be dealt
>> with by the window manager rather than the application. Perhaps
>> in the future there might be support for application hinting that
>> could allow vim to have foreground()/gtk_window_present work as
>> "expected", but in the meantime this patch performs an explicit
>> move& raise.
>>
>> I added the code to if_xcmdsrv.c since it's toolkit independent
>> and there's already similar X functions there.
>>
>> I hope others find this useful.
>
> You don't need to patch the code for that:
>
> vim -c "call remote-foreground('foobar')"
>
> or (from an already-running Vim)
>
> :call remote-foreground('foobar')
>
> where foobar is the server name. See ":help remote-foreground()"
>
Thanks for the feedback Tony. On all but win32, the remote_foreground()
call is the same as a remote-send foreground(). As discussed above,
the resulting gtk_window_present call doesn't do anything useful on many
(most?) window managers. I didn't patch foreground() and opted for a
new explicit option to the remote arguments for two main reasons. First
this explicit move & raise seems best matched by an explicit option - so
as not to surprise any existing users of foreground() with new behaviour.
Second the code is non-toolkit specific so it made more sense to me to
add it to if_xcmdsrv.c rather than gui_gtk_x11.c. That said, it's a
simple one line addition to call the new activateWindow function from
gui_mch_set_foreground.
For some background discussion on the handling of gtk_window_present see
this post: http://blogs.gnome.org/metacity/2008/10/20/by-these-presents/.
Paul
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---