diff options
| author | K. Handa | 2016-01-03 17:53:43 +0900 |
|---|---|---|
| committer | K. Handa | 2016-01-03 17:53:43 +0900 |
| commit | fb6d826c69939c2d016c1b824d4e9bcb53d9e643 (patch) | |
| tree | b9ce862d6cbe25e740203421984df21e4cbadbf4 /src/w32term.c | |
| parent | 536f48e9a2251b9e654ea974bd90ff2f40218753 (diff) | |
| parent | 91917dd58ec5278e555b9c693a830749083e8f89 (diff) | |
| download | emacs-fb6d826c69939c2d016c1b824d4e9bcb53d9e643.tar.gz emacs-fb6d826c69939c2d016c1b824d4e9bcb53d9e643.zip | |
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Diffstat (limited to 'src/w32term.c')
| -rw-r--r-- | src/w32term.c | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/src/w32term.c b/src/w32term.c index f764e250aa8..60d64f7fd0f 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -23,6 +23,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 23 | #include "lisp.h" | 23 | #include "lisp.h" |
| 24 | #include "blockinput.h" | 24 | #include "blockinput.h" |
| 25 | #include "w32term.h" | 25 | #include "w32term.h" |
| 26 | #include "w32common.h" /* for OS version info */ | ||
| 26 | 27 | ||
| 27 | #include <ctype.h> | 28 | #include <ctype.h> |
| 28 | #include <errno.h> | 29 | #include <errno.h> |
| @@ -6115,9 +6116,22 @@ x_set_window_size (struct frame *f, bool change_gravity, | |||
| 6115 | int pixelwidth, pixelheight; | 6116 | int pixelwidth, pixelheight; |
| 6116 | Lisp_Object fullscreen = get_frame_param (f, Qfullscreen); | 6117 | Lisp_Object fullscreen = get_frame_param (f, Qfullscreen); |
| 6117 | RECT rect; | 6118 | RECT rect; |
| 6119 | MENUBARINFO info; | ||
| 6120 | int menu_bar_height; | ||
| 6118 | 6121 | ||
| 6119 | block_input (); | 6122 | block_input (); |
| 6120 | 6123 | ||
| 6124 | /* Get the height of the menu bar here. It's used below to detect | ||
| 6125 | whether the menu bar is wrapped. It's also used to specify the | ||
| 6126 | third argument for AdjustWindowRect. FRAME_EXTERNAL_MENU_BAR which | ||
| 6127 | has been used before for that reason is unreliable because it only | ||
| 6128 | specifies whether we _want_ a menu bar for this frame and not | ||
| 6129 | whether this frame _has_ a menu bar. See bug#22105. */ | ||
| 6130 | info.cbSize = sizeof (info); | ||
| 6131 | info.rcBar.top = info.rcBar.bottom = 0; | ||
| 6132 | GetMenuBarInfo (FRAME_W32_WINDOW (f), 0xFFFFFFFD, 0, &info); | ||
| 6133 | menu_bar_height = info.rcBar.bottom - info.rcBar.top; | ||
| 6134 | |||
| 6121 | if (pixelwise) | 6135 | if (pixelwise) |
| 6122 | { | 6136 | { |
| 6123 | pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, width); | 6137 | pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, width); |
| @@ -6135,17 +6149,11 @@ x_set_window_size (struct frame *f, bool change_gravity, | |||
| 6135 | height of the frame then the wrapped menu bar lines are not | 6149 | height of the frame then the wrapped menu bar lines are not |
| 6136 | accounted for (Bug#15174 and Bug#18720). Here we add these | 6150 | accounted for (Bug#15174 and Bug#18720). Here we add these |
| 6137 | extra lines to the frame height. */ | 6151 | extra lines to the frame height. */ |
| 6138 | MENUBARINFO info; | ||
| 6139 | int default_menu_bar_height; | 6152 | int default_menu_bar_height; |
| 6140 | int menu_bar_height; | ||
| 6141 | 6153 | ||
| 6142 | /* Why is (apparently) SM_CYMENUSIZE needed here instead of | 6154 | /* Why is (apparently) SM_CYMENUSIZE needed here instead of |
| 6143 | SM_CYMENU ?? */ | 6155 | SM_CYMENU ?? */ |
| 6144 | default_menu_bar_height = GetSystemMetrics (SM_CYMENUSIZE); | 6156 | default_menu_bar_height = GetSystemMetrics (SM_CYMENUSIZE); |
| 6145 | info.cbSize = sizeof (info); | ||
| 6146 | info.rcBar.top = info.rcBar.bottom = 0; | ||
| 6147 | GetMenuBarInfo (FRAME_W32_WINDOW (f), 0xFFFFFFFD, 0, &info); | ||
| 6148 | menu_bar_height = info.rcBar.bottom - info.rcBar.top; | ||
| 6149 | 6157 | ||
| 6150 | if ((default_menu_bar_height > 0) | 6158 | if ((default_menu_bar_height > 0) |
| 6151 | && (menu_bar_height > default_menu_bar_height) | 6159 | && (menu_bar_height > default_menu_bar_height) |
| @@ -6160,8 +6168,7 @@ x_set_window_size (struct frame *f, bool change_gravity, | |||
| 6160 | rect.right = pixelwidth; | 6168 | rect.right = pixelwidth; |
| 6161 | rect.bottom = pixelheight; | 6169 | rect.bottom = pixelheight; |
| 6162 | 6170 | ||
| 6163 | AdjustWindowRect (&rect, f->output_data.w32->dwStyle, | 6171 | AdjustWindowRect (&rect, f->output_data.w32->dwStyle, menu_bar_height > 0); |
| 6164 | FRAME_EXTERNAL_MENU_BAR (f)); | ||
| 6165 | 6172 | ||
| 6166 | if (!(f->after_make_frame) | 6173 | if (!(f->after_make_frame) |
| 6167 | && !(f->want_fullscreen & FULLSCREEN_WAIT) | 6174 | && !(f->want_fullscreen & FULLSCREEN_WAIT) |
| @@ -6231,6 +6238,8 @@ x_set_window_size (struct frame *f, bool change_gravity, | |||
| 6231 | void | 6238 | void |
| 6232 | frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) | 6239 | frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) |
| 6233 | { | 6240 | { |
| 6241 | UINT trail_num = 0; | ||
| 6242 | BOOL ret = false; | ||
| 6234 | RECT rect; | 6243 | RECT rect; |
| 6235 | POINT pt; | 6244 | POINT pt; |
| 6236 | 6245 | ||
| @@ -6241,7 +6250,15 @@ frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) | |||
| 6241 | pt.y = rect.top + pix_y; | 6250 | pt.y = rect.top + pix_y; |
| 6242 | ClientToScreen (FRAME_W32_WINDOW (f), &pt); | 6251 | ClientToScreen (FRAME_W32_WINDOW (f), &pt); |
| 6243 | 6252 | ||
| 6253 | /* When "mouse trails" are in effect, moving the mouse cursor | ||
| 6254 | sometimes leaves behind an annoying "ghost" of the pointer. | ||
| 6255 | Avoid that by momentarily switching off mouse trails. */ | ||
| 6256 | if (os_subtype == OS_NT | ||
| 6257 | && w32_major_version + w32_minor_version >= 6) | ||
| 6258 | ret = SystemParametersInfo (SPI_GETMOUSETRAILS, 0, &trail_num, 0); | ||
| 6244 | SetCursorPos (pt.x, pt.y); | 6259 | SetCursorPos (pt.x, pt.y); |
| 6260 | if (ret) | ||
| 6261 | SystemParametersInfo (SPI_SETMOUSETRAILS, trail_num, NULL, 0); | ||
| 6245 | 6262 | ||
| 6246 | unblock_input (); | 6263 | unblock_input (); |
| 6247 | } | 6264 | } |
| @@ -6925,6 +6942,15 @@ x_delete_display (struct w32_display_info *dpyinfo) | |||
| 6925 | 6942 | ||
| 6926 | /* Set up use of W32. */ | 6943 | /* Set up use of W32. */ |
| 6927 | 6944 | ||
| 6945 | void | ||
| 6946 | w32_init_main_thread (void) | ||
| 6947 | { | ||
| 6948 | dwMainThreadId = GetCurrentThreadId (); | ||
| 6949 | DuplicateHandle (GetCurrentProcess (), GetCurrentThread (), | ||
| 6950 | GetCurrentProcess (), &hMainThread, 0, TRUE, | ||
| 6951 | DUPLICATE_SAME_ACCESS); | ||
| 6952 | } | ||
| 6953 | |||
| 6928 | DWORD WINAPI w32_msg_worker (void * arg); | 6954 | DWORD WINAPI w32_msg_worker (void * arg); |
| 6929 | 6955 | ||
| 6930 | static void | 6956 | static void |
| @@ -6985,10 +7011,6 @@ w32_initialize (void) | |||
| 6985 | terminates */ | 7011 | terminates */ |
| 6986 | init_crit (); | 7012 | init_crit (); |
| 6987 | 7013 | ||
| 6988 | dwMainThreadId = GetCurrentThreadId (); | ||
| 6989 | DuplicateHandle (GetCurrentProcess (), GetCurrentThread (), | ||
| 6990 | GetCurrentProcess (), &hMainThread, 0, TRUE, DUPLICATE_SAME_ACCESS); | ||
| 6991 | |||
| 6992 | /* Wait for thread to start */ | 7014 | /* Wait for thread to start */ |
| 6993 | { | 7015 | { |
| 6994 | MSG msg; | 7016 | MSG msg; |