Loading ...
Sorry, an error occurred while loading the content.
 

[patch] remote-raise option

Expand Messages
  • Paul Egan
    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
    Message 1 of 4 , Jan 21, 2009
      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 received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Tony Mechelynck
      ... You don t need to patch the code for that: vim -c call remote-foreground( foobar ) or (from an already-running Vim) ... where foobar is the server name.
      Message 2 of 4 , Jan 22, 2009
        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()"


        Best regards,
        Tony.
        --
        Playing an unamplified electric guitar is like strumming on a picnic
        table.
        -- Dave Barry, "The Snake"

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_dev" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Paul Egan
        ... 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
        Message 3 of 4 , Jan 22, 2009
          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
          -~----------~----~----~----~------~----~------~--~---
        • Bram Moolenaar
          ... The patch moves the gvim server from one desktop to another. In my opinion users have intentionally put applications on a certain desktop and don t want
          Message 4 of 4 , Feb 28, 2009
            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.

            The patch moves the gvim server from one desktop to another. In my
            opinion users have intentionally put applications on a certain desktop
            and don't want them being moved elsewhere. It's usually better to
            switch to that desktop.

            I think you made this to have the command bring the Vim server onto the
            screen, so that you can start using it. The foreground() call is
            intended to do the same thing. Implementing them differently is
            confusing.

            If you can make the code make the desktop that contains Vim the current
            destktop, then it can be part of foreground(). And then remote-raise
            can invoke foreground() to do its work.

            --
            hundred-and-one symptoms of being an internet addict:
            139. You down your lunch in five minutes, at your desk, so you can
            spend the rest of the hour surfing the Net.

            /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
            /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
            \\\ download, build and distribute -- http://www.A-A-P.org ///
            \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_dev" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          Your message has been successfully submitted and would be delivered to recipients shortly.