diff options
| author | Jason Rumney | 2002-02-17 23:42:40 +0000 |
|---|---|---|
| committer | Jason Rumney | 2002-02-17 23:42:40 +0000 |
| commit | 549808dbb69e0e6e34af9948e2422bbaf7016d6c (patch) | |
| tree | d7150f0fcd8b4c32e3f09c191ca38dc6a9277ce7 /src | |
| parent | 01f323c6e9a7227f7c5fae3967b0f11579a9d92d (diff) | |
| download | emacs-549808dbb69e0e6e34af9948e2422bbaf7016d6c.tar.gz emacs-549808dbb69e0e6e34af9948e2422bbaf7016d6c.zip | |
* w32term.c (x_autoselect_window_p): New variable.
(syms_of_w32term): DEFVAR_BOOL and initialize it.
(note_mouse_movement): Use it.
* w32term.c (x_check_fullscreen, x_check_fullscreen_move)
(x_fullscreen_adjust): New functions.
(w32_read_socket) <WM_WINDOWPOSCHANGED>: Don't resize to
fullscreen. Call x_check_fullscreen_move, and set the
want_fullscreen member of output_data.w32
<WM_ACTIVATE, WM_ACTIVATEAPP>: Call x_check_fullscreen.
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32term.c | 153 |
1 files changed, 153 insertions, 0 deletions
diff --git a/src/w32term.c b/src/w32term.c index c9fa8e99335..3c0e7c7deae 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -170,6 +170,10 @@ static Lisp_Object previous_help_echo; | |||
| 170 | 170 | ||
| 171 | static int any_help_event_p; | 171 | static int any_help_event_p; |
| 172 | 172 | ||
| 173 | /* Non-zero means autoselect window with the mouse cursor. */ | ||
| 174 | |||
| 175 | int x_autoselect_window_p; | ||
| 176 | |||
| 173 | /* Non-zero means draw block and hollow cursor as wide as the glyph | 177 | /* Non-zero means draw block and hollow cursor as wide as the glyph |
| 174 | under it. For example, if a block cursor is over a tab, it will be | 178 | under it. For example, if a block cursor is over a tab, it will be |
| 175 | drawn as wide as that tab on the display. */ | 179 | drawn as wide as that tab on the display. */ |
| @@ -6290,6 +6294,26 @@ note_mouse_movement (frame, msg) | |||
| 6290 | memcpy (&last_mouse_motion_event, msg, sizeof (last_mouse_motion_event)); | 6294 | memcpy (&last_mouse_motion_event, msg, sizeof (last_mouse_motion_event)); |
| 6291 | XSETFRAME (last_mouse_motion_frame, frame); | 6295 | XSETFRAME (last_mouse_motion_frame, frame); |
| 6292 | 6296 | ||
| 6297 | if (x_autoselect_window_p) | ||
| 6298 | { | ||
| 6299 | int area; | ||
| 6300 | Lisp_Object window; | ||
| 6301 | static Lisp_Object last_window; | ||
| 6302 | |||
| 6303 | window = window_from_coordinates (frame, mouse_x, mouse_y, &area, 0); | ||
| 6304 | |||
| 6305 | /* Window will be selected only when it is not selected now and | ||
| 6306 | last mouse movement event was not in it. Minubuffer window | ||
| 6307 | will be selected iff it is active. */ | ||
| 6308 | if (!EQ (window, last_window) | ||
| 6309 | && !EQ (window, selected_window) | ||
| 6310 | && (!MINI_WINDOW_P (XWINDOW (window)) | ||
| 6311 | || (EQ (window, minibuf_window) && minibuf_level > 0))) | ||
| 6312 | Fselect_window (window); | ||
| 6313 | |||
| 6314 | last_window=window; | ||
| 6315 | } | ||
| 6316 | |||
| 6293 | if (msg->hwnd != FRAME_W32_WINDOW (frame)) | 6317 | if (msg->hwnd != FRAME_W32_WINDOW (frame)) |
| 6294 | { | 6318 | { |
| 6295 | frame->mouse_moved = 1; | 6319 | frame->mouse_moved = 1; |
| @@ -7568,6 +7592,8 @@ cancel_mouse_face (f) | |||
| 7568 | 7592 | ||
| 7569 | static struct scroll_bar *x_window_to_scroll_bar (); | 7593 | static struct scroll_bar *x_window_to_scroll_bar (); |
| 7570 | static void x_scroll_bar_report_motion (); | 7594 | static void x_scroll_bar_report_motion (); |
| 7595 | static void x_check_fullscreen P_ ((struct frame *)); | ||
| 7596 | static void x_check_fullscreen_move P_ ((struct frame *)); | ||
| 7571 | static int glyph_rect P_ ((struct frame *f, int, int, RECT *)); | 7597 | static int glyph_rect P_ ((struct frame *f, int, int, RECT *)); |
| 7572 | 7598 | ||
| 7573 | 7599 | ||
| @@ -8867,8 +8893,22 @@ w32_read_socket (sd, bufp, numchars, expected) | |||
| 8867 | } | 8893 | } |
| 8868 | 8894 | ||
| 8869 | case WM_WINDOWPOSCHANGED: | 8895 | case WM_WINDOWPOSCHANGED: |
| 8896 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | ||
| 8897 | if (f) | ||
| 8898 | { | ||
| 8899 | x_check_fullscreen_move(f); | ||
| 8900 | if (f->output_data.w32->want_fullscreen & FULLSCREEN_WAIT) | ||
| 8901 | f->output_data.w32->want_fullscreen &= | ||
| 8902 | ~(FULLSCREEN_WAIT|FULLSCREEN_BOTH); | ||
| 8903 | } | ||
| 8904 | check_visibility = 1; | ||
| 8905 | break; | ||
| 8906 | |||
| 8870 | case WM_ACTIVATE: | 8907 | case WM_ACTIVATE: |
| 8871 | case WM_ACTIVATEAPP: | 8908 | case WM_ACTIVATEAPP: |
| 8909 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | ||
| 8910 | if (f) | ||
| 8911 | x_check_fullscreen (f); | ||
| 8872 | check_visibility = 1; | 8912 | check_visibility = 1; |
| 8873 | break; | 8913 | break; |
| 8874 | 8914 | ||
| @@ -10236,6 +10276,115 @@ x_set_offset (f, xoff, yoff, change_gravity) | |||
| 10236 | UNBLOCK_INPUT; | 10276 | UNBLOCK_INPUT; |
| 10237 | } | 10277 | } |
| 10238 | 10278 | ||
| 10279 | |||
| 10280 | /* Check if we need to resize the frame due to a fullscreen request. | ||
| 10281 | If so needed, resize the frame. */ | ||
| 10282 | static void | ||
| 10283 | x_check_fullscreen (f) | ||
| 10284 | struct frame *f; | ||
| 10285 | { | ||
| 10286 | if (f->output_data.w32->want_fullscreen & FULLSCREEN_BOTH) | ||
| 10287 | { | ||
| 10288 | int width, height, ign; | ||
| 10289 | |||
| 10290 | x_real_positions (f, &f->output_data.w32->left_pos, | ||
| 10291 | &f->output_data.w32->top_pos); | ||
| 10292 | |||
| 10293 | x_fullscreen_adjust (f, &width, &height, &ign, &ign); | ||
| 10294 | |||
| 10295 | /* We do not need to move the window, it shall be taken care of | ||
| 10296 | when setting WM manager hints. | ||
| 10297 | If the frame is visible already, the position is checked by | ||
| 10298 | x_check_fullscreen_move. */ | ||
| 10299 | if (f->width != width || f->height != height) | ||
| 10300 | { | ||
| 10301 | change_frame_size (f, height, width, 0, 1, 0); | ||
| 10302 | SET_FRAME_GARBAGED (f); | ||
| 10303 | cancel_mouse_face (f); | ||
| 10304 | |||
| 10305 | /* Wait for the change of frame size to occur */ | ||
| 10306 | f->output_data.w32->want_fullscreen |= FULLSCREEN_WAIT; | ||
| 10307 | } | ||
| 10308 | } | ||
| 10309 | } | ||
| 10310 | |||
| 10311 | /* If frame parameters are set after the frame is mapped, we need to move | ||
| 10312 | the window. This is done in xfns.c. | ||
| 10313 | Some window managers moves the window to the right position, some | ||
| 10314 | moves the outer window manager window to the specified position. | ||
| 10315 | Here we check that we are in the right spot. If not, make a second | ||
| 10316 | move, assuming we are dealing with the second kind of window manager. */ | ||
| 10317 | static void | ||
| 10318 | x_check_fullscreen_move (f) | ||
| 10319 | struct frame *f; | ||
| 10320 | { | ||
| 10321 | if (f->output_data.w32->want_fullscreen & FULLSCREEN_MOVE_WAIT) | ||
| 10322 | { | ||
| 10323 | int expect_top = f->output_data.w32->top_pos; | ||
| 10324 | int expect_left = f->output_data.w32->left_pos; | ||
| 10325 | |||
| 10326 | if (f->output_data.w32->want_fullscreen & FULLSCREEN_HEIGHT) | ||
| 10327 | expect_top = 0; | ||
| 10328 | if (f->output_data.w32->want_fullscreen & FULLSCREEN_WIDTH) | ||
| 10329 | expect_left = 0; | ||
| 10330 | |||
| 10331 | if (expect_top != f->output_data.w32->top_pos | ||
| 10332 | || expect_left != f->output_data.w32->left_pos) | ||
| 10333 | x_set_offset (f, expect_left, expect_top, 1); | ||
| 10334 | |||
| 10335 | /* Just do this once */ | ||
| 10336 | f->output_data.w32->want_fullscreen &= ~FULLSCREEN_MOVE_WAIT; | ||
| 10337 | } | ||
| 10338 | } | ||
| 10339 | |||
| 10340 | |||
| 10341 | /* Calculate fullscreen size. Return in *TOP_POS and *LEFT_POS the | ||
| 10342 | wanted positions of the WM window (not emacs window). | ||
| 10343 | Return in *WIDTH and *HEIGHT the wanted width and height of Emacs | ||
| 10344 | window (FRAME_X_WINDOW). | ||
| 10345 | */ | ||
| 10346 | void | ||
| 10347 | x_fullscreen_adjust (f, width, height, top_pos, left_pos) | ||
| 10348 | struct frame *f; | ||
| 10349 | int *width; | ||
| 10350 | int *height; | ||
| 10351 | int *top_pos; | ||
| 10352 | int *left_pos; | ||
| 10353 | { | ||
| 10354 | int newwidth = f->width, newheight = f->height; | ||
| 10355 | |||
| 10356 | *top_pos = f->output_data.w32->top_pos; | ||
| 10357 | *left_pos = f->output_data.w32->left_pos; | ||
| 10358 | |||
| 10359 | if (f->output_data.w32->want_fullscreen & FULLSCREEN_HEIGHT) | ||
| 10360 | { | ||
| 10361 | int ph; | ||
| 10362 | |||
| 10363 | ph = FRAME_X_DISPLAY_INFO (f)->height; | ||
| 10364 | newheight = PIXEL_TO_CHAR_HEIGHT (f, ph); | ||
| 10365 | ph = CHAR_TO_PIXEL_HEIGHT (f, newheight) | ||
| 10366 | - f->output_data.w32->y_pixels_diff; | ||
| 10367 | newheight = PIXEL_TO_CHAR_HEIGHT (f, ph); | ||
| 10368 | *top_pos = 0; | ||
| 10369 | } | ||
| 10370 | |||
| 10371 | if (f->output_data.w32->want_fullscreen & FULLSCREEN_WIDTH) | ||
| 10372 | { | ||
| 10373 | int pw; | ||
| 10374 | |||
| 10375 | pw = FRAME_X_DISPLAY_INFO (f)->width; | ||
| 10376 | newwidth = PIXEL_TO_CHAR_WIDTH (f, pw); | ||
| 10377 | pw = CHAR_TO_PIXEL_WIDTH (f, newwidth) | ||
| 10378 | - f->output_data.w32->x_pixels_diff; | ||
| 10379 | newwidth = PIXEL_TO_CHAR_WIDTH (f, pw); | ||
| 10380 | *left_pos = 0; | ||
| 10381 | } | ||
| 10382 | |||
| 10383 | *width = newwidth; | ||
| 10384 | *height = newheight; | ||
| 10385 | } | ||
| 10386 | |||
| 10387 | |||
| 10239 | /* Call this to change the size of frame F's x-window. | 10388 | /* Call this to change the size of frame F's x-window. |
| 10240 | If CHANGE_GRAVITY is 1, we change to top-left-corner window gravity | 10389 | If CHANGE_GRAVITY is 1, we change to top-left-corner window gravity |
| 10241 | for this size change and subsequent size changes. | 10390 | for this size change and subsequent size changes. |
| @@ -11210,6 +11359,10 @@ affect on NT machines. */); | |||
| 11210 | staticpro (&previous_help_echo); | 11359 | staticpro (&previous_help_echo); |
| 11211 | help_echo_pos = -1; | 11360 | help_echo_pos = -1; |
| 11212 | 11361 | ||
| 11362 | DEFVAR_BOOL ("x-autoselect-window", &x_autoselect_window_p, | ||
| 11363 | doc: /* *Non-nil means autoselect window with mouse pointer. */); | ||
| 11364 | x_autoselect_window_p = 0; | ||
| 11365 | |||
| 11213 | DEFVAR_BOOL ("w32-use-visible-system-caret", | 11366 | DEFVAR_BOOL ("w32-use-visible-system-caret", |
| 11214 | &w32_use_visible_system_caret, | 11367 | &w32_use_visible_system_caret, |
| 11215 | doc: /* Flag to make the system caret visible. | 11368 | doc: /* Flag to make the system caret visible. |