* mouse cursor on MS-Windows.
@ 2002-09-07 0:37 KOBAYASHI Yasuhiro
0 siblings, 0 replies; 2+ messages in thread
From: KOBAYASHI Yasuhiro @ 2002-09-07 0:37 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 105 bytes --]
Mouse cursor is always ARROW shape on Ms-windows.
This is the patch for sensitive cursor on MS-Windows.
[-- Attachment #2: cursor.diff --]
[-- Type: application/octet-stream, Size: 11532 bytes --]
*** emacs/src/w32term.h.orig Sat Aug 31 00:10:30 2002
--- emacs/src/w32term.h Fri Sep 6 23:25:40 2002
***************
*** 350,355 ****
--- 350,356 ----
Cursor cross_cursor;
Cursor hourglass_cursor;
Cursor horizontal_drag_cursor;
+ Cursor hand_cursor;
/* Window whose cursor is hourglass_cursor. This window is
temporarily mapped to display an hourglass cursor. */
***************
*** 735,741 ****
#define WM_EMACS_DESTROY_CARET (WM_EMACS_START + 16)
#define WM_EMACS_SHOW_CARET (WM_EMACS_START + 17)
#define WM_EMACS_HIDE_CARET (WM_EMACS_START + 18)
! #define WM_EMACS_END (WM_EMACS_START + 19)
#define WND_FONTWIDTH_INDEX (0)
#define WND_LINEHEIGHT_INDEX (4)
--- 736,743 ----
#define WM_EMACS_DESTROY_CARET (WM_EMACS_START + 16)
#define WM_EMACS_SHOW_CARET (WM_EMACS_START + 17)
#define WM_EMACS_HIDE_CARET (WM_EMACS_START + 18)
! #define WM_EMACS_SETCURSOR (WM_EMACS_START + 19)
! #define WM_EMACS_END (WM_EMACS_START + 20)
#define WND_FONTWIDTH_INDEX (0)
#define WND_LINEHEIGHT_INDEX (4)
*** emacs/src/w32term.c.orig Sat Aug 31 00:10:30 2002
--- emacs/src/w32term.c Sat Sep 7 00:06:14 2002
***************
*** 367,372 ****
--- 367,376 ----
enum draw_glyphs_face));
static int cursor_in_mouse_face_p P_ ((struct window *));
static int clear_mouse_face P_ ((struct w32_display_info *));
+ typedef int Display;
+ #define FRAME_X_DISPLAY(f) ((Display *) 0)
+ #define FRAME_X_WINDOW(f) ((f)->output_data.w32->window_desc)
+ void XDefineCursor P_ ((Display *, Window, Cursor));
void x_lower_frame P_ ((struct frame *));
void x_scroll_bar_clear P_ ((struct frame *));
***************
*** 6587,6596 ****
}
}
}
-
- #if 0 /* TODO: mouse cursor */
XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), cursor);
- #endif
}
--- 6591,6597 ----
***************
*** 6608,6613 ****
--- 6609,6615 ----
int portion;
Lisp_Object window;
struct window *w;
+ Cursor cursor = 0;
struct buffer *b;
/* When a menu is active, don't highlight because this looks odd. */
***************
*** 6663,6674 ****
note_mode_line_highlight (w, x, portion == 1);
return;
}
! #if 0 /* TODO: mouse cursor */
if (portion == 2)
! cursor = f->output_data.x->horizontal_drag_cursor;
else
! cursor = f->output_data.x->text_cursor;
! #endif
/* Are we in a window whose display is up to date?
And verify the buffer's text has not changed. */
b = XBUFFER (w->buffer);
--- 6665,6676 ----
note_mode_line_highlight (w, x, portion == 1);
return;
}
!
if (portion == 2)
! cursor = f->output_data.w32->horizontal_drag_cursor;
else
! cursor = f->output_data.w32->text_cursor;
!
/* Are we in a window whose display is up to date?
And verify the buffer's text has not changed. */
b = XBUFFER (w->buffer);
***************
*** 6696,6702 ****
|| !MATRIX_ROW (w->current_matrix, vpos)->displays_text_p)
{
clear_mouse_face (dpyinfo);
! /* TODO: mouse cursor */
goto set_cursor;
}
--- 6698,6704 ----
|| !MATRIX_ROW (w->current_matrix, vpos)->displays_text_p)
{
clear_mouse_face (dpyinfo);
! cursor = f->output_data.w32->nontext_cursor;
goto set_cursor;
}
***************
*** 6751,6758 ****
|| hpos < dpyinfo->mouse_face_end_col
|| dpyinfo->mouse_face_past_end));
! /* TODO: if (same_region)
! mouse cursor */
/* Check mouse-face highlighting. */
if (! same_region
--- 6753,6760 ----
|| hpos < dpyinfo->mouse_face_end_col
|| dpyinfo->mouse_face_past_end));
! if (same_region)
! cursor = 0;
/* Check mouse-face highlighting. */
if (! same_region
***************
*** 6782,6789 ****
dpyinfo->mouse_face_overlay = overlay;
/* Clear the display of the old active region, if any. */
! clear_mouse_face (dpyinfo);
! /* TODO: mouse cursor changes. */
/* If no overlay applies, get a text property. */
if (NILP (overlay))
--- 6784,6791 ----
dpyinfo->mouse_face_overlay = overlay;
/* Clear the display of the old active region, if any. */
! if (clear_mouse_face (dpyinfo))
! cursor = 0;
/* If no overlay applies, get a text property. */
if (NILP (overlay))
***************
*** 6820,6826 ****
/* Display it as active. */
show_mouse_face (dpyinfo, DRAW_MOUSE_FACE);
! /* TODO: mouse cursor changes. */
}
/* Handle the text property case. */
else if (! NILP (mouse_face) && BUFFERP (object))
--- 6822,6828 ----
/* Display it as active. */
show_mouse_face (dpyinfo, DRAW_MOUSE_FACE);
! cursor = 0;
}
/* Handle the text property case. */
else if (! NILP (mouse_face) && BUFFERP (object))
***************
*** 6862,6868 ****
/* Display it as active. */
show_mouse_face (dpyinfo, DRAW_MOUSE_FACE);
! /* TODO: mouse cursor changes. */
}
else if (!NILP (mouse_face) && STRINGP (object))
{
--- 6864,6870 ----
/* Display it as active. */
show_mouse_face (dpyinfo, DRAW_MOUSE_FACE);
! cursor = 0;
}
else if (!NILP (mouse_face) && STRINGP (object))
{
***************
*** 6894,6900 ****
= face_at_string_position (w, object, pos, 0, 0, 0, &ignore,
glyph->face_id, 1);
show_mouse_face (dpyinfo, DRAW_MOUSE_FACE);
! /* TODO: mouse cursor changes. */
}
else if (STRINGP (object) && NILP (mouse_face))
{
--- 6896,6902 ----
= face_at_string_position (w, object, pos, 0, 0, 0, &ignore,
glyph->face_id, 1);
show_mouse_face (dpyinfo, DRAW_MOUSE_FACE);
! cursor = 0;
}
else if (STRINGP (object) && NILP (mouse_face))
{
***************
*** 6941,6947 ****
/* Display it as active. */
show_mouse_face (dpyinfo, DRAW_MOUSE_FACE);
! /* TODO: mouse cursor changes. */
}
}
}
--- 6943,6949 ----
/* Display it as active. */
show_mouse_face (dpyinfo, DRAW_MOUSE_FACE);
! cursor = 0;
}
}
}
***************
*** 7021,7028 ****
}
set_cursor:
! /* TODO: mouse cursor changes. */
! ;
}
static void
--- 7023,7030 ----
}
set_cursor:
! if (cursor)
! XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), cursor);
}
static void
***************
*** 7035,7040 ****
--- 7037,7050 ----
HIWORD (last_mouse_motion_event.lParam));
}
+ void
+ XDefineCursor (display, window, cursor)
+ Display *display;
+ Window window;
+ Cursor cursor;
+ {
+ PostMessage (window, WM_EMACS_SETCURSOR, (WPARAM) cursor, 0);
+ }
\f
/***********************************************************************
***************
*** 7575,7592 ****
w->phys_cursor.x, w->phys_cursor.y);
}
- #if 0 /* TODO: mouse cursor */
/* Change the mouse cursor. */
if (draw == DRAW_NORMAL_TEXT)
XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
! f->output_data.x->text_cursor);
else if (draw == DRAW_MOUSE_FACE)
XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
! f->output_data.x->cross_cursor);
else
XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
! f->output_data.x->nontext_cursor);
! #endif
}
/* Clear out the mouse-highlighted active region.
--- 7585,7601 ----
w->phys_cursor.x, w->phys_cursor.y);
}
/* Change the mouse cursor. */
if (draw == DRAW_NORMAL_TEXT)
XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
! f->output_data.w32->text_cursor);
else if (draw == DRAW_MOUSE_FACE)
XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
! f->output_data.w32->hand_cursor);
else
XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
! f->output_data.w32->nontext_cursor);
!
}
/* Clear out the mouse-highlighted active region.
***************
*** 11065,11070 ****
--- 11074,11081 ----
dpyinfo->mouse_face_window = Qnil;
dpyinfo->mouse_face_overlay = Qnil;
dpyinfo->mouse_face_hidden = 0;
+
+ dpyinfo->vertical_scroll_bar_cursor = (Cursor) IDC_ARROW;
/* TODO: dpyinfo->gray */
}
*** emacs/src/w32fns.c.orig Sat Aug 31 10:25:56 2002
--- emacs/src/w32fns.c Fri Sep 6 23:45:14 2002
***************
*** 162,168 ****
over text or in the modeline. */
Lisp_Object Vx_pointer_shape, Vx_nontext_pointer_shape, Vx_mode_pointer_shape;
! Lisp_Object Vx_hourglass_pointer_shape, Vx_window_horizontal_drag_shape;
/* The shape when over mouse-sensitive text. */
--- 162,168 ----
over text or in the modeline. */
Lisp_Object Vx_pointer_shape, Vx_nontext_pointer_shape, Vx_mode_pointer_shape;
! Lisp_Object Vx_hourglass_pointer_shape, Vx_window_horizontal_drag_shape, Vx_hand_shape;
/* The shape when over mouse-sensitive text. */
***************
*** 2198,2203 ****
--- 2198,2204 ----
else
horizontal_drag_cursor
= XCreateFontCursor (FRAME_X_DISPLAY (f), XC_sb_h_double_arrow);
+ /* TODO: hand_cursor */
/* Check and report errors with the above calls. */
x_check_errors (FRAME_W32_DISPLAY (f), "can't set cursor shape: %s");
***************
*** 2226,2231 ****
--- 2227,2233 ----
&fore_color, &back_color);
XRecolorCursor (FRAME_W32_DISPLAY (f), hourglass_cursor,
&fore_color, &back_color);
+ /* TODO: hand_cursor */
}
if (FRAME_W32_WINDOW (f) != 0)
***************
*** 2254,2259 ****
--- 2256,2262 ----
&& f->output_data.w32->cross_cursor != 0)
XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->cross_cursor);
f->output_data.w32->cross_cursor = cross_cursor;
+ /* TODO: hand_cursor */
XFlush (FRAME_W32_DISPLAY (f));
UNBLOCK_INPUT;
***************
*** 5065,5070 ****
--- 5068,5089 ----
((LPMINMAXINFO) lParam)->ptMaxTrackSize.y = 32767;
return 0;
+ case WM_SETCURSOR:
+ if (LOWORD (lParam) == HTCLIENT)
+ return 0;
+
+ goto dflt;
+
+ case WM_EMACS_SETCURSOR:
+ {
+ HANDLE hc;
+
+ hc = LoadImage (NULL, (LPCTSTR) wParam, IMAGE_CURSOR, 0, 0,
+ LR_DEFAULTCOLOR | LR_DEFAULTSIZE | LR_SHARED);
+ SetCursor (hc);
+ return 0;
+ }
+
case WM_EMACS_CREATESCROLLBAR:
return (LRESULT) w32_createscrollbar ((struct frame *) wParam,
(struct scroll_bar *) lParam);
***************
*** 5655,5660 ****
--- 5674,5688 ----
f->output_data.w32->dwStyle = WS_OVERLAPPEDWINDOW;
f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window;
+ /* Cursor type for LoadImage()*/
+ f->output_data.w32->text_cursor = (Cursor) IDC_IBEAM;
+ f->output_data.w32->nontext_cursor = (Cursor) IDC_ARROW;
+ f->output_data.w32->modeline_cursor = (Cursor) IDC_ARROW;
+ f->output_data.w32->cross_cursor = (Cursor) IDC_CROSS;
+ f->output_data.w32->hourglass_cursor = (Cursor) IDC_WAIT;
+ f->output_data.w32->horizontal_drag_cursor = (Cursor) IDC_IBEAM;
+ f->output_data.w32->hand_cursor = (Cursor) IDC_HAND;
+
/* Add the tool-bar height to the initial frame height so that the
user gets a text display area of the size he specified with -g or
via .Xdefaults. Later changes of the tool-bar height don't
[-- Attachment #3: Type: text/plain, Size: 50 bytes --]
--
KOBAYASHI Yasuhiro <kobayays@otsukakj.co.jp>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: mouse cursor on MS-Windows.
@ 2002-09-10 12:38 David PONCE
0 siblings, 0 replies; 2+ messages in thread
From: David PONCE @ 2002-09-10 12:38 UTC (permalink / raw)
Cc: emacs-devel
Hi,
> Mouse cursor is always ARROW shape on Ms-windows.
>
> This is the patch for sensitive cursor on MS-Windows.
I tried your patch and it seems to work well. Thanks!
However I got a little problem with the hand cursor. It seems that
IDC_HAND is not supported by W95 and NT (I run Emacs on NT4). A
consequence is that the cursor disappeared over a mouse-sensitive text
:-(
I changed IDC_HAND by IDC_UPARROW and now I see that cursor over a
mouse-sensitive text.
Hope this will help.
David
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-09-10 12:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-10 12:38 mouse cursor on MS-Windows David PONCE
-- strict thread matches above, loose matches on Subject: below --
2002-09-07 0:37 KOBAYASHI Yasuhiro
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).