/[emacs]/emacs/src/w32term.c
ViewVC logotype

Diff of /emacs/src/w32term.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.189 by kfstorm, Sat May 24 22:06:19 2003 UTC revision 1.190 by lektu, Mon May 26 23:01:05 2003 UTC
# Line 495  w32_draw_vertical_window_border (w, x, y Line 495  w32_draw_vertical_window_border (w, x, y
495    struct frame *f = XFRAME (WINDOW_FRAME (w));    struct frame *f = XFRAME (WINDOW_FRAME (w));
496    RECT r;    RECT r;
497    HDC hdc;    HDC hdc;
498      
499    r.left = x;    r.left = x;
500    r.right = x + 1;    r.right = x + 1;
501    r.top = y0;    r.top = y0;
# Line 2911  construct_mouse_wheel (result, msg, f) Line 2911  construct_mouse_wheel (result, msg, f)
2911       struct frame *f;       struct frame *f;
2912  {  {
2913    POINT p;    POINT p;
2914    result->kind = MOUSE_WHEEL_EVENT;    result->kind = MOUSE_CLICK_EVENT;
2915    result->code = (short) HIWORD (msg->msg.wParam);    result->code = (GET_WHEEL_DELTA_WPARAM (msg->msg.wParam) < 0) ? 4 : 3;
2916    result->timestamp = msg->msg.time;    result->timestamp = msg->msg.time;
2917    result->modifiers = msg->dwModifiers;    result->modifiers = msg->dwModifiers;
2918    p.x = LOWORD (msg->msg.lParam);    p.x = LOWORD (msg->msg.lParam);
# Line 3111  glyph_rect (f, x, y, rect) Line 3111  glyph_rect (f, x, y, rect)
3111    
3112              /* x is to the right of the last glyph in the row.  */              /* x is to the right of the last glyph in the row.  */
3113              rect->left = WINDOW_TO_FRAME_PIXEL_X (w, gx);              rect->left = WINDOW_TO_FRAME_PIXEL_X (w, gx);
3114              /* Shouldn't this be a pixel value?                /* Shouldn't this be a pixel value?
3115                 WINDOW_RIGHT_EDGE_X (w) seems to be the right value.                 WINDOW_RIGHT_EDGE_X (w) seems to be the right value.
3116                 ++KFS */                 ++KFS */
3117              rect->right = WINDOW_RIGHT_EDGE_COL (w);              rect->right = WINDOW_RIGHT_EDGE_COL (w);
# Line 4382  w32_read_socket (sd, bufp, numchars, exp Line 4382  w32_read_socket (sd, bufp, numchars, exp
4382              break;              break;
4383            }            }
4384    
4385        case WM_MOUSEWHEEL:          case WM_MOUSEWHEEL:
4386            if (dpyinfo->grabbed && last_mouse_frame            {
4387                && FRAME_LIVE_P (last_mouse_frame))              /* Convert each Windows mouse wheel event in a couple of
4388              f = last_mouse_frame;                 Emacs mouse click down/up events.  Scrolling the wheel up
4389            else                 is associated to mouse button 4 and scrolling the wheel
4390              f = x_window_to_frame (dpyinfo, msg.msg.hwnd);                 down to the mouse button 5.  */
4391                int button;
4392                int up;
4393    
4394            if (f)              up = msg.dwModifiers & up_modifier;
4395              {  
4396                if ((!dpyinfo->w32_focus_frame              if (dpyinfo->grabbed && last_mouse_frame
4397                     || f == dpyinfo->w32_focus_frame)                  && FRAME_LIVE_P (last_mouse_frame))
4398                    && (numchars >= 1))                f = last_mouse_frame;
4399                  {              else
4400                    construct_mouse_wheel (bufp, &msg, f);                f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
4401                    bufp++;  
4402                    count++;              if (f)
4403                    numchars--;                {
4404                  }                  Lisp_Object window;
4405              }                  POINT p;
4406                    int x, y;
4407    
4408                    p.x = LOWORD (msg.msg.lParam);
4409                    p.y = HIWORD (msg.msg.lParam);
4410                    ScreenToClient (msg.msg.hwnd, &p);
4411                    x = XFASTINT (p.x);
4412                    y = XFASTINT (p.y);
4413    
4414                    window = window_from_coordinates (f, x, y, 0, 0, 0, 0);
4415    
4416                    /* Ignore mouse wheel events not in a window.  */
4417                    if (!WINDOWP(window))
4418                      break;
4419    
4420                    if ((!dpyinfo->w32_focus_frame
4421                         || f == dpyinfo->w32_focus_frame)
4422                        && (numchars >= 1))
4423                      {
4424                        if ( !up )
4425                          {
4426                            /* Emit an Emacs mouse down message.  */
4427                            msg.dwModifiers |= down_modifier;
4428                            construct_mouse_wheel (bufp, &msg, f);
4429                            bufp++;
4430                            count++;
4431                            numchars--;
4432    
4433                            /* Push a simulated WM_MOUSEWHEEL up message.  */
4434                            msg.dwModifiers &= ~down_modifier;
4435                            msg.dwModifiers |= up_modifier;
4436                            prepend_msg (&msg);
4437                          }
4438                        else
4439                          {
4440                            /* Emit an Emacs mouse up message.  */
4441                            construct_mouse_wheel (bufp, &msg, f);
4442                            bufp++;
4443                            count++;
4444                            numchars--;
4445                          }
4446                      }
4447                  }
4448    
4449                button = ( GET_WHEEL_DELTA_WPARAM (msg.msg.wParam) < 0 )? 4 : 3;
4450    
4451                if (up)
4452                  {
4453                    dpyinfo->grabbed &= ~ (1 << button);
4454                  }
4455                else
4456                  {
4457                    dpyinfo->grabbed |= (1 << button);
4458                    last_mouse_frame = f;
4459                    /* Ignore any mouse motion that happened
4460                       before this event; any subsequent mouse-movement
4461                       Emacs events should reflect only motion after
4462                       the ButtonPress.  */
4463                    if (f != 0)
4464                      f->mouse_moved = 0;
4465    
4466                    last_tool_bar_item = -1;
4467                  }
4468              }
4469            break;            break;
4470    
4471          case WM_DROPFILES:          case WM_DROPFILES:
# Line 4624  w32_read_socket (sd, bufp, numchars, exp Line 4689  w32_read_socket (sd, bufp, numchars, exp
4689          case WM_SETFOCUS:          case WM_SETFOCUS:
4690            /* TODO: Port this change:            /* TODO: Port this change:
4691               2002-06-28  Jan D.  <jan.h.d@swipnet.se>               2002-06-28  Jan D.  <jan.h.d@swipnet.se>
4692             * xterm.h (struct x_output): Add focus_state.               * xterm.h (struct x_output): Add focus_state.
4693             * xterm.c (x_focus_changed): New function.               * xterm.c (x_focus_changed): New function.
4694               (x_detect_focus_change): New function.               (x_detect_focus_change): New function.
4695               (XTread_socket): Call x_detect_focus_change for FocusIn/FocusOut               (XTread_socket): Call x_detect_focus_change for FocusIn/FocusOut
4696               EnterNotify and LeaveNotify to track X focus changes.               EnterNotify and LeaveNotify to track X focus changes.
4697             */            */
4698            f = x_any_window_to_frame (dpyinfo, msg.msg.hwnd);            f = x_any_window_to_frame (dpyinfo, msg.msg.hwnd);
4699    
4700            dpyinfo->w32_focus_event_frame = f;            dpyinfo->w32_focus_event_frame = f;
# Line 4791  w32_read_socket (sd, bufp, numchars, exp Line 4856  w32_read_socket (sd, bufp, numchars, exp
4856        Lisp_Object tail, frame;        Lisp_Object tail, frame;
4857    
4858        FOR_EACH_FRAME (tail, frame)        FOR_EACH_FRAME (tail, frame)
4859          {        {
4860            FRAME_PTR f = XFRAME (frame);          FRAME_PTR f = XFRAME (frame);
4861            /* The tooltip has been drawn already.  Avoid the          /* The tooltip has been drawn already.  Avoid the
4862               SET_FRAME_GARBAGED below.  */             SET_FRAME_GARBAGED below.  */
4863            if (EQ (frame, tip_frame))          if (EQ (frame, tip_frame))
4864              continue;            continue;
4865    
4866            /* Check "visible" frames and mark each as obscured or not.          /* Check "visible" frames and mark each as obscured or not.
4867               Note that async_visible is nonzero for unobscured and             Note that async_visible is nonzero for unobscured and
4868               obscured frames, but zero for hidden and iconified frames.  */             obscured frames, but zero for hidden and iconified frames.  */
4869            if (FRAME_W32_P (f) && f->async_visible)          if (FRAME_W32_P (f) && f->async_visible)
4870              {            {
4871                RECT clipbox;              RECT clipbox;
4872                HDC  hdc;              HDC  hdc;
4873    
4874                enter_crit ();              enter_crit ();
4875                /* Query clipping rectangle for the entire window area              /* Query clipping rectangle for the entire window area
4876                   (GetWindowDC), not just the client portion (GetDC).                 (GetWindowDC), not just the client portion (GetDC).
4877                   Otherwise, the scrollbars and menubar aren't counted as                 Otherwise, the scrollbars and menubar aren't counted as
4878                   part of the visible area of the frame, and we may think                 part of the visible area of the frame, and we may think
4879                   the frame is obscured when really a scrollbar is still                 the frame is obscured when really a scrollbar is still
4880                   visible and gets WM_PAINT messages above.  */                 visible and gets WM_PAINT messages above.  */
4881                hdc = GetWindowDC (FRAME_W32_WINDOW (f));              hdc = GetWindowDC (FRAME_W32_WINDOW (f));
4882                GetClipBox (hdc, &clipbox);              GetClipBox (hdc, &clipbox);
4883                ReleaseDC (FRAME_W32_WINDOW (f), hdc);              ReleaseDC (FRAME_W32_WINDOW (f), hdc);
4884                leave_crit ();              leave_crit ();
4885    
4886                if (clipbox.right == clipbox.left              if (clipbox.right == clipbox.left
4887                    || clipbox.bottom == clipbox.top)                  || clipbox.bottom == clipbox.top)
4888                  {                {
4889                    /* Frame has become completely obscured so mark as                  /* Frame has become completely obscured so mark as
4890                       such (we do this by setting async_visible to 2 so                     such (we do this by setting async_visible to 2 so
4891                       that FRAME_VISIBLE_P is still true, but redisplay                     that FRAME_VISIBLE_P is still true, but redisplay
4892                       will skip it).  */                     will skip it).  */
4893                    f->async_visible = 2;                  f->async_visible = 2;
4894    
4895                    if (!FRAME_OBSCURED_P (f))                  if (!FRAME_OBSCURED_P (f))
4896                      {                    {
4897                        DebPrint (("frame %p (%s) obscured\n", f,                      DebPrint (("frame %p (%s) obscured\n", f,
4898                                   SDATA (f->name)));                                 SDATA (f->name)));
4899                      }                    }
4900                  }                }
4901                else              else
4902                  {                {
4903                    /* Frame is not obscured, so mark it as such.  */                  /* Frame is not obscured, so mark it as such.  */
4904                    f->async_visible = 1;                  f->async_visible = 1;
4905    
4906                    if (FRAME_OBSCURED_P (f))                  if (FRAME_OBSCURED_P (f))
4907                      {                    {
4908                        SET_FRAME_GARBAGED (f);                      SET_FRAME_GARBAGED (f);
4909                        DebPrint (("obscured frame %p (%s) found to be visible\n", f,                      DebPrint (("obscured frame %p (%s) found to be visible\n", f,
4910                                   SDATA (f->name)));                                 SDATA (f->name)));
4911    
4912                        /* Force a redisplay sooner or later.  */                      /* Force a redisplay sooner or later.  */
4913                        record_asynch_buffer_change ();                      record_asynch_buffer_change ();
4914                      }                    }
4915                  }                }
4916              }            }
4917          }        }
4918      }      }
4919    
4920    UNBLOCK_INPUT;    UNBLOCK_INPUT;
# Line 6223  w32_term_init (display_name, xrm_option, Line 6288  w32_term_init (display_name, xrm_option,
6288          unsigned char *bits = fringe_bitmaps[i].bits;          unsigned char *bits = fringe_bitmaps[i].bits;
6289          for (j = 0; j < h; j++)          for (j = 0; j < h; j++)
6290            {            {
6291              static unsigned char swap_nibble[16]              static unsigned char swap_nibble[16]
6292                = { 0x0, 0x8, 0x4, 0xc,    /* 0000 1000 0100 1100 */                = { 0x0, 0x8, 0x4, 0xc,    /* 0000 1000 0100 1100 */
6293                    0x2, 0xa, 0x6, 0xe,    /* 0010 1010 0110 1110 */                    0x2, 0xa, 0x6, 0xe,    /* 0010 1010 0110 1110 */
6294                    0x1, 0x9, 0x5, 0xd,    /* 0001 1001 0101 1101 */                    0x1, 0x9, 0x5, 0xd,    /* 0001 1001 0101 1101 */
6295                    0x3, 0xb, 0x7, 0xf };  /* 0011 1011 0111 1111 */                    0x3, 0xb, 0x7, 0xf };  /* 0011 1011 0111 1111 */
6296                      
6297              unsigned char b = *bits++;              unsigned char b = *bits++;
6298              *wb++ = (unsigned short)((swap_nibble[b & 0xf]<<4)              *wb++ = (unsigned short)((swap_nibble[b & 0xf]<<4)
6299                                       | (swap_nibble[(b>>4) & 0xf]));                                       | (swap_nibble[(b>>4) & 0xf]));

Legend:
Removed from v.1.189  
changed lines
  Added in v.1.190

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26