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

Fwd: Fix gui_mch_set_winpos()

Expand Messages
  • Jjgod Jiang
    ... --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_mac maillist. For more information, visit
    Message 1 of 2 , Aug 19, 2007
    • 0 Attachment
      2007/5/5, Jjgod Jiang <gzjjgod@...>:
      > Hi all,
      >
      > Try :winpos 0 0 and :winpos 0 22 with current mac vim, then you will
      > see the problem. The following patch provides a solution, please
      > review it and tell me what do you think.
      >
      > Thanks macmania for reporting this.
      >
      > - jjgod
      >
      > Index: gui_mac.c
      > ===================================================================
      > --- gui_mac.c (revision 254)
      > +++ gui_mac.c (working copy)
      > @@ -124,6 +124,8 @@
      > ControlActionUPP gScrollAction;
      > ControlActionUPP gScrollDrag;
      >
      > +static int gTitleBarHeight = 0;
      > +
      > /* Keeping track of which scrollbar is being dragged */
      > static ControlHandle dragged_sb = NULL;
      >
      > @@ -2984,6 +2986,8 @@
      > InstallReceiveHandler((DragReceiveHandlerUPP)receiveHandler,
      > gui.VimWindow, NULL);
      > SetPortWindowPort(gui.VimWindow);
      > + GetWindowBounds(gui.VimWindow, kWindowTitleBarRgn, &titleRect);
      > + gTitleBarHeight = titleRect.bottom - titleRect.top;
      >
      > gui.char_width = 7;
      > gui.char_height = 11;
      > @@ -3170,8 +3174,14 @@
      > {
      > /* TODO: Should make sure the window is move within range
      > * e.g.: y > ~16 [Menu bar], x > 0, x < screen width
      > + *
      > + * It turns out MoveWindow moves relative to the content
      > + * region while GetWindowBounds returns the whole window,
      > + * including title bar height, so we must add this height
      > + * to the y argument of MoveWindow, so that the title bar
      > + * will not be covered by menu.
      > */
      > - MoveWindow(gui.VimWindow, x, y, TRUE);
      > + MoveWindow(gui.VimWindow, x, y + gTitleBarHeight, TRUE);
      > }
      >
      > void
      >

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