diff options
| author | Jason Rumney | 2003-01-21 23:05:18 +0000 |
|---|---|---|
| committer | Jason Rumney | 2003-01-21 23:05:18 +0000 |
| commit | c9b2104df66f2d2c3dbea992b37fdd704c990b27 (patch) | |
| tree | 0112b83d94a4f646414c38381c2bd61af3087ef2 | |
| parent | 4d80e3ae6d9a732d47cbe6d6dba9ddcaa2becf11 (diff) | |
| download | emacs-c9b2104df66f2d2c3dbea992b37fdd704c990b27.tar.gz emacs-c9b2104df66f2d2c3dbea992b37fdd704c990b27.zip | |
2003-01-21 Jason Rumney <jasonr@gnu.org>
* w32fns.c (IDC_HAND): Define it if system headers don't.
2003-01-21 KOBAYASHI Yasuhiro <kobayays@otsukakj.co.jp>
* w32fns.c (Vx_hand_shape): New variable.
(w32_wnd_proc): Add message entries for WM_SETCURSOR and
WM_EMACS_SETCURSOR.
(x-create-frame): Setup Cursor types.
2003-01-21 David Ponce <david@dponce.com>
* w32fns.c (w32_load_cursor): New function.
(w32_init_class): Use it.
(x_put_x_image): Declare all args.
| -rw-r--r-- | src/w32fns.c | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/src/w32fns.c b/src/w32fns.c index b0f485ce698..3e1f678d02c 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -155,12 +155,16 @@ int display_hourglass_p; | |||
| 155 | over text or in the modeline. */ | 155 | over text or in the modeline. */ |
| 156 | 156 | ||
| 157 | Lisp_Object Vx_pointer_shape, Vx_nontext_pointer_shape, Vx_mode_pointer_shape; | 157 | Lisp_Object Vx_pointer_shape, Vx_nontext_pointer_shape, Vx_mode_pointer_shape; |
| 158 | Lisp_Object Vx_hourglass_pointer_shape, Vx_window_horizontal_drag_shape; | 158 | Lisp_Object Vx_hourglass_pointer_shape, Vx_window_horizontal_drag_shape, Vx_hand_shape; |
| 159 | 159 | ||
| 160 | /* The shape when over mouse-sensitive text. */ | 160 | /* The shape when over mouse-sensitive text. */ |
| 161 | 161 | ||
| 162 | Lisp_Object Vx_sensitive_text_pointer_shape; | 162 | Lisp_Object Vx_sensitive_text_pointer_shape; |
| 163 | 163 | ||
| 164 | #ifndef IDC_HAND | ||
| 165 | #define IDC_HAND MAKEINTRESOURCE(32649) | ||
| 166 | #endif | ||
| 167 | |||
| 164 | /* Color of chars displayed in cursor box. */ | 168 | /* Color of chars displayed in cursor box. */ |
| 165 | 169 | ||
| 166 | Lisp_Object Vx_cursor_fore_pixel; | 170 | Lisp_Object Vx_cursor_fore_pixel; |
| @@ -2196,6 +2200,7 @@ x_set_mouse_color (f, arg, oldval) | |||
| 2196 | else | 2200 | else |
| 2197 | horizontal_drag_cursor | 2201 | horizontal_drag_cursor |
| 2198 | = XCreateFontCursor (FRAME_X_DISPLAY (f), XC_sb_h_double_arrow); | 2202 | = XCreateFontCursor (FRAME_X_DISPLAY (f), XC_sb_h_double_arrow); |
| 2203 | /* TODO: hand_cursor */ | ||
| 2199 | 2204 | ||
| 2200 | /* Check and report errors with the above calls. */ | 2205 | /* Check and report errors with the above calls. */ |
| 2201 | x_check_errors (FRAME_W32_DISPLAY (f), "can't set cursor shape: %s"); | 2206 | x_check_errors (FRAME_W32_DISPLAY (f), "can't set cursor shape: %s"); |
| @@ -2224,6 +2229,7 @@ x_set_mouse_color (f, arg, oldval) | |||
| 2224 | &fore_color, &back_color); | 2229 | &fore_color, &back_color); |
| 2225 | XRecolorCursor (FRAME_W32_DISPLAY (f), hourglass_cursor, | 2230 | XRecolorCursor (FRAME_W32_DISPLAY (f), hourglass_cursor, |
| 2226 | &fore_color, &back_color); | 2231 | &fore_color, &back_color); |
| 2232 | /* TODO: hand_cursor */ | ||
| 2227 | } | 2233 | } |
| 2228 | 2234 | ||
| 2229 | if (FRAME_W32_WINDOW (f) != 0) | 2235 | if (FRAME_W32_WINDOW (f) != 0) |
| @@ -2252,6 +2258,7 @@ x_set_mouse_color (f, arg, oldval) | |||
| 2252 | && f->output_data.w32->cross_cursor != 0) | 2258 | && f->output_data.w32->cross_cursor != 0) |
| 2253 | XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->cross_cursor); | 2259 | XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->cross_cursor); |
| 2254 | f->output_data.w32->cross_cursor = cross_cursor; | 2260 | f->output_data.w32->cross_cursor = cross_cursor; |
| 2261 | /* TODO: hand_cursor */ | ||
| 2255 | 2262 | ||
| 2256 | XFlush (FRAME_W32_DISPLAY (f)); | 2263 | XFlush (FRAME_W32_DISPLAY (f)); |
| 2257 | UNBLOCK_INPUT; | 2264 | UNBLOCK_INPUT; |
| @@ -3420,6 +3427,21 @@ x_figure_window_size (f, parms) | |||
| 3420 | } | 3427 | } |
| 3421 | 3428 | ||
| 3422 | 3429 | ||
| 3430 | Cursor | ||
| 3431 | w32_load_cursor (LPCTSTR name) | ||
| 3432 | { | ||
| 3433 | /* Try first to load cursor from application resource. */ | ||
| 3434 | Cursor cursor = LoadImage ((HINSTANCE) GetModuleHandle(NULL), | ||
| 3435 | name, IMAGE_CURSOR, 0, 0, | ||
| 3436 | LR_DEFAULTCOLOR | LR_DEFAULTSIZE | LR_SHARED); | ||
| 3437 | if (!cursor) | ||
| 3438 | { | ||
| 3439 | /* Then try to load a shared predefined cursor. */ | ||
| 3440 | cursor = LoadImage (NULL, name, IMAGE_CURSOR, 0, 0, | ||
| 3441 | LR_DEFAULTCOLOR | LR_DEFAULTSIZE | LR_SHARED); | ||
| 3442 | } | ||
| 3443 | return cursor; | ||
| 3444 | } | ||
| 3423 | 3445 | ||
| 3424 | extern LRESULT CALLBACK w32_wnd_proc (); | 3446 | extern LRESULT CALLBACK w32_wnd_proc (); |
| 3425 | 3447 | ||
| @@ -3435,7 +3457,7 @@ w32_init_class (hinst) | |||
| 3435 | wc.cbWndExtra = WND_EXTRA_BYTES; | 3457 | wc.cbWndExtra = WND_EXTRA_BYTES; |
| 3436 | wc.hInstance = hinst; | 3458 | wc.hInstance = hinst; |
| 3437 | wc.hIcon = LoadIcon (hinst, EMACS_CLASS); | 3459 | wc.hIcon = LoadIcon (hinst, EMACS_CLASS); |
| 3438 | wc.hCursor = LoadCursor (NULL, IDC_ARROW); | 3460 | wc.hCursor = w32_load_cursor (IDC_ARROW); |
| 3439 | wc.hbrBackground = NULL; /* GetStockObject (WHITE_BRUSH); */ | 3461 | wc.hbrBackground = NULL; /* GetStockObject (WHITE_BRUSH); */ |
| 3440 | wc.lpszMenuName = NULL; | 3462 | wc.lpszMenuName = NULL; |
| 3441 | wc.lpszClassName = EMACS_CLASS; | 3463 | wc.lpszClassName = EMACS_CLASS; |
| @@ -5063,6 +5085,20 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) | |||
| 5063 | ((LPMINMAXINFO) lParam)->ptMaxTrackSize.y = 32767; | 5085 | ((LPMINMAXINFO) lParam)->ptMaxTrackSize.y = 32767; |
| 5064 | return 0; | 5086 | return 0; |
| 5065 | 5087 | ||
| 5088 | case WM_SETCURSOR: | ||
| 5089 | if (LOWORD (lParam) == HTCLIENT) | ||
| 5090 | return 0; | ||
| 5091 | |||
| 5092 | goto dflt; | ||
| 5093 | |||
| 5094 | case WM_EMACS_SETCURSOR: | ||
| 5095 | { | ||
| 5096 | Cursor cursor = (Cursor) wParam; | ||
| 5097 | if (cursor) | ||
| 5098 | SetCursor (cursor); | ||
| 5099 | return 0; | ||
| 5100 | } | ||
| 5101 | |||
| 5066 | case WM_EMACS_CREATESCROLLBAR: | 5102 | case WM_EMACS_CREATESCROLLBAR: |
| 5067 | return (LRESULT) w32_createscrollbar ((struct frame *) wParam, | 5103 | return (LRESULT) w32_createscrollbar ((struct frame *) wParam, |
| 5068 | (struct scroll_bar *) lParam); | 5104 | (struct scroll_bar *) lParam); |
| @@ -5653,6 +5689,14 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 5653 | f->output_data.w32->dwStyle = WS_OVERLAPPEDWINDOW; | 5689 | f->output_data.w32->dwStyle = WS_OVERLAPPEDWINDOW; |
| 5654 | f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window; | 5690 | f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window; |
| 5655 | 5691 | ||
| 5692 | f->output_data.w32->text_cursor = w32_load_cursor (IDC_IBEAM); | ||
| 5693 | f->output_data.w32->nontext_cursor = w32_load_cursor (IDC_ARROW); | ||
| 5694 | f->output_data.w32->modeline_cursor = w32_load_cursor (IDC_ARROW); | ||
| 5695 | f->output_data.w32->cross_cursor = w32_load_cursor (IDC_CROSS); | ||
| 5696 | f->output_data.w32->hourglass_cursor = w32_load_cursor (IDC_WAIT); | ||
| 5697 | f->output_data.w32->horizontal_drag_cursor = w32_load_cursor (IDC_SIZEWE); | ||
| 5698 | f->output_data.w32->hand_cursor = w32_load_cursor (IDC_HAND); | ||
| 5699 | |||
| 5656 | /* Add the tool-bar height to the initial frame height so that the | 5700 | /* Add the tool-bar height to the initial frame height so that the |
| 5657 | user gets a text display area of the size he specified with -g or | 5701 | user gets a text display area of the size he specified with -g or |
| 5658 | via .Xdefaults. Later changes of the tool-bar height don't | 5702 | via .Xdefaults. Later changes of the tool-bar height don't |
| @@ -9420,6 +9464,7 @@ x_put_x_image (f, ximg, pixmap, width, height) | |||
| 9420 | struct frame *f; | 9464 | struct frame *f; |
| 9421 | XImage *ximg; | 9465 | XImage *ximg; |
| 9422 | Pixmap pixmap; | 9466 | Pixmap pixmap; |
| 9467 | int width, height; | ||
| 9423 | { | 9468 | { |
| 9424 | #if 0 /* I don't think this is necessary looking at where it is used. */ | 9469 | #if 0 /* I don't think this is necessary looking at where it is used. */ |
| 9425 | HDC hdc = get_frame_dc (f); | 9470 | HDC hdc = get_frame_dc (f); |