diff options
Diffstat (limited to 'src/w32fns.c')
| -rw-r--r-- | src/w32fns.c | 185 |
1 files changed, 97 insertions, 88 deletions
diff --git a/src/w32fns.c b/src/w32fns.c index 90f5b1695ea..bd54e990efc 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Graphical user interface functions for the Microsoft Windows API. | 1 | /* Graphical user interface functions for the Microsoft Windows API. |
| 2 | 2 | ||
| 3 | Copyright (C) 1989, 1992-2012 Free Software Foundation, Inc. | 3 | Copyright (C) 1989, 1992-2013 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| 6 | 6 | ||
| @@ -82,7 +82,6 @@ void syms_of_w32fns (void); | |||
| 82 | void globals_of_w32fns (void); | 82 | void globals_of_w32fns (void); |
| 83 | 83 | ||
| 84 | extern void free_frame_menubar (struct frame *); | 84 | extern void free_frame_menubar (struct frame *); |
| 85 | extern double atof (const char *); | ||
| 86 | extern int w32_console_toggle_lock_key (int, Lisp_Object); | 85 | extern int w32_console_toggle_lock_key (int, Lisp_Object); |
| 87 | extern void w32_menu_display_help (HWND, HMENU, UINT, UINT); | 86 | extern void w32_menu_display_help (HWND, HMENU, UINT, UINT); |
| 88 | extern void w32_free_menu_strings (HWND); | 87 | extern void w32_free_menu_strings (HWND); |
| @@ -223,7 +222,7 @@ SYSTEM_INFO sysinfo_cache; | |||
| 223 | /* This gives us version, build, and platform identification. */ | 222 | /* This gives us version, build, and platform identification. */ |
| 224 | OSVERSIONINFO osinfo_cache; | 223 | OSVERSIONINFO osinfo_cache; |
| 225 | 224 | ||
| 226 | unsigned long syspage_mask = 0; | 225 | DWORD_PTR syspage_mask = 0; |
| 227 | 226 | ||
| 228 | /* The major and minor versions of NT. */ | 227 | /* The major and minor versions of NT. */ |
| 229 | int w32_major_version; | 228 | int w32_major_version; |
| @@ -1722,11 +1721,9 @@ x_set_name (struct frame *f, Lisp_Object name, int explicit) | |||
| 1722 | 1721 | ||
| 1723 | if (FRAME_W32_WINDOW (f)) | 1722 | if (FRAME_W32_WINDOW (f)) |
| 1724 | { | 1723 | { |
| 1725 | if (STRING_MULTIBYTE (name)) | ||
| 1726 | name = ENCODE_SYSTEM (name); | ||
| 1727 | |||
| 1728 | block_input (); | 1724 | block_input (); |
| 1729 | SetWindowText (FRAME_W32_WINDOW (f), SDATA (name)); | 1725 | GUI_FN (SetWindowText) (FRAME_W32_WINDOW (f), |
| 1726 | GUI_SDATA (GUI_ENCODE_SYSTEM (name))); | ||
| 1730 | unblock_input (); | 1727 | unblock_input (); |
| 1731 | } | 1728 | } |
| 1732 | } | 1729 | } |
| @@ -1768,11 +1765,9 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name) | |||
| 1768 | 1765 | ||
| 1769 | if (FRAME_W32_WINDOW (f)) | 1766 | if (FRAME_W32_WINDOW (f)) |
| 1770 | { | 1767 | { |
| 1771 | if (STRING_MULTIBYTE (name)) | ||
| 1772 | name = ENCODE_SYSTEM (name); | ||
| 1773 | |||
| 1774 | block_input (); | 1768 | block_input (); |
| 1775 | SetWindowText (FRAME_W32_WINDOW (f), SDATA (name)); | 1769 | GUI_FN (SetWindowText) (FRAME_W32_WINDOW (f), |
| 1770 | GUI_SDATA (GUI_ENCODE_SYSTEM (name))); | ||
| 1776 | unblock_input (); | 1771 | unblock_input (); |
| 1777 | } | 1772 | } |
| 1778 | } | 1773 | } |
| @@ -1822,7 +1817,6 @@ static LRESULT CALLBACK w32_wnd_proc (HWND, UINT, WPARAM, LPARAM); | |||
| 1822 | static BOOL | 1817 | static BOOL |
| 1823 | w32_init_class (HINSTANCE hinst) | 1818 | w32_init_class (HINSTANCE hinst) |
| 1824 | { | 1819 | { |
| 1825 | |||
| 1826 | if (w32_unicode_gui) | 1820 | if (w32_unicode_gui) |
| 1827 | { | 1821 | { |
| 1828 | WNDCLASSW uwc; | 1822 | WNDCLASSW uwc; |
| @@ -3161,8 +3155,26 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | |||
| 3161 | form.ptCurrentPos.y = w32_system_caret_y; | 3155 | form.ptCurrentPos.y = w32_system_caret_y; |
| 3162 | 3156 | ||
| 3163 | form.rcArea.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, 0); | 3157 | form.rcArea.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, 0); |
| 3158 | |||
| 3159 | #ifdef ENABLE_CHECKING | ||
| 3160 | /* Temporary code to catch crashes in computing form.rcArea.top. */ | ||
| 3161 | { | ||
| 3162 | int wmbp = WINDOW_MENU_BAR_P (w); | ||
| 3163 | int wtbp = WINDOW_TOOL_BAR_P (w); | ||
| 3164 | struct frame *wf = WINDOW_XFRAME (w); | ||
| 3165 | int fibw = FRAME_INTERNAL_BORDER_WIDTH (wf); | ||
| 3166 | int wtel = WINDOW_TOP_EDGE_LINE (w); | ||
| 3167 | int wflh = FRAME_LINE_HEIGHT (wf); | ||
| 3168 | int wwhlp= WINDOW_WANTS_HEADER_LINE_P (w); | ||
| 3169 | int chlh = CURRENT_HEADER_LINE_HEIGHT (w); | ||
| 3170 | int whlh = (wwhlp ? chlh : 0); | ||
| 3171 | |||
| 3172 | form.rcArea.top = ((wmbp || wtbp) ? 0 : fibw) + wtel * wflh + whlh; | ||
| 3173 | } | ||
| 3174 | #else | ||
| 3164 | form.rcArea.top = (WINDOW_TOP_EDGE_Y (w) | 3175 | form.rcArea.top = (WINDOW_TOP_EDGE_Y (w) |
| 3165 | + WINDOW_HEADER_LINE_HEIGHT (w)); | 3176 | + WINDOW_HEADER_LINE_HEIGHT (w)); |
| 3177 | #endif | ||
| 3166 | form.rcArea.right = (WINDOW_BOX_RIGHT_EDGE_X (w) | 3178 | form.rcArea.right = (WINDOW_BOX_RIGHT_EDGE_X (w) |
| 3167 | - WINDOW_RIGHT_MARGIN_WIDTH (w) | 3179 | - WINDOW_RIGHT_MARGIN_WIDTH (w) |
| 3168 | - WINDOW_RIGHT_FRINGE_WIDTH (w)); | 3180 | - WINDOW_RIGHT_FRINGE_WIDTH (w)); |
| @@ -3958,6 +3970,9 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | |||
| 3958 | 3970 | ||
| 3959 | return retval; | 3971 | return retval; |
| 3960 | } | 3972 | } |
| 3973 | case WM_EMACS_FILENOTIFY: | ||
| 3974 | my_post_msg (&wmsg, hwnd, msg, wParam, lParam); | ||
| 3975 | return 1; | ||
| 3961 | 3976 | ||
| 3962 | default: | 3977 | default: |
| 3963 | /* Check for messages registered at runtime. */ | 3978 | /* Check for messages registered at runtime. */ |
| @@ -4356,9 +4371,6 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 4356 | specbind (Qx_resource_name, name); | 4371 | specbind (Qx_resource_name, name); |
| 4357 | } | 4372 | } |
| 4358 | 4373 | ||
| 4359 | f->resx = dpyinfo->resx; | ||
| 4360 | f->resy = dpyinfo->resy; | ||
| 4361 | |||
| 4362 | if (uniscribe_available) | 4374 | if (uniscribe_available) |
| 4363 | register_font_driver (&uniscribe_font_driver, f); | 4375 | register_font_driver (&uniscribe_font_driver, f); |
| 4364 | register_font_driver (&w32font_driver, f); | 4376 | register_font_driver (&w32font_driver, f); |
| @@ -4586,12 +4598,9 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, | |||
| 4586 | CHECK_STRING (color); | 4598 | CHECK_STRING (color); |
| 4587 | 4599 | ||
| 4588 | if (w32_defined_color (f, SDATA (color), &foo, 0)) | 4600 | if (w32_defined_color (f, SDATA (color), &foo, 0)) |
| 4589 | return list3 (make_number ((GetRValue (foo.pixel) << 8) | 4601 | return list3i ((GetRValue (foo.pixel) << 8) | GetRValue (foo.pixel), |
| 4590 | | GetRValue (foo.pixel)), | 4602 | (GetGValue (foo.pixel) << 8) | GetGValue (foo.pixel), |
| 4591 | make_number ((GetGValue (foo.pixel) << 8) | 4603 | (GetBValue (foo.pixel) << 8) | GetBValue (foo.pixel)); |
| 4592 | | GetGValue (foo.pixel)), | ||
| 4593 | make_number ((GetBValue (foo.pixel) << 8) | ||
| 4594 | | GetBValue (foo.pixel))); | ||
| 4595 | else | 4604 | else |
| 4596 | return Qnil; | 4605 | return Qnil; |
| 4597 | } | 4606 | } |
| @@ -4717,9 +4726,7 @@ DISPLAY should be either a frame or a display name (a string). | |||
| 4717 | If omitted or nil, that stands for the selected frame's display. */) | 4726 | If omitted or nil, that stands for the selected frame's display. */) |
| 4718 | (Lisp_Object display) | 4727 | (Lisp_Object display) |
| 4719 | { | 4728 | { |
| 4720 | return Fcons (make_number (w32_major_version), | 4729 | return list3i (w32_major_version, w32_minor_version, w32_build_number); |
| 4721 | Fcons (make_number (w32_minor_version), | ||
| 4722 | Fcons (make_number (w32_build_number), Qnil))); | ||
| 4723 | } | 4730 | } |
| 4724 | 4731 | ||
| 4725 | DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0, | 4732 | DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0, |
| @@ -4867,18 +4874,6 @@ x_pixel_height (register struct frame *f) | |||
| 4867 | } | 4874 | } |
| 4868 | 4875 | ||
| 4869 | int | 4876 | int |
| 4870 | x_char_width (register struct frame *f) | ||
| 4871 | { | ||
| 4872 | return FRAME_COLUMN_WIDTH (f); | ||
| 4873 | } | ||
| 4874 | |||
| 4875 | int | ||
| 4876 | x_char_height (register struct frame *f) | ||
| 4877 | { | ||
| 4878 | return FRAME_LINE_HEIGHT (f); | ||
| 4879 | } | ||
| 4880 | |||
| 4881 | int | ||
| 4882 | x_screen_planes (register struct frame *f) | 4877 | x_screen_planes (register struct frame *f) |
| 4883 | { | 4878 | { |
| 4884 | return FRAME_W32_DISPLAY_INFO (f)->n_planes; | 4879 | return FRAME_W32_DISPLAY_INFO (f)->n_planes; |
| @@ -5440,9 +5435,6 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, | |||
| 5440 | specbind (Qx_resource_name, name); | 5435 | specbind (Qx_resource_name, name); |
| 5441 | } | 5436 | } |
| 5442 | 5437 | ||
| 5443 | f->resx = dpyinfo->resx; | ||
| 5444 | f->resy = dpyinfo->resy; | ||
| 5445 | |||
| 5446 | if (uniscribe_available) | 5438 | if (uniscribe_available) |
| 5447 | register_font_driver (&uniscribe_font_driver, f); | 5439 | register_font_driver (&uniscribe_font_driver, f); |
| 5448 | register_font_driver (&w32font_driver, f); | 5440 | register_font_driver (&w32font_driver, f); |
| @@ -5800,8 +5792,8 @@ Text larger than the specified size is clipped. */) | |||
| 5800 | 5792 | ||
| 5801 | /* Set up the frame's root window. */ | 5793 | /* Set up the frame's root window. */ |
| 5802 | w = XWINDOW (FRAME_ROOT_WINDOW (f)); | 5794 | w = XWINDOW (FRAME_ROOT_WINDOW (f)); |
| 5803 | wset_left_col (w, make_number (0)); | 5795 | w->left_col = 0; |
| 5804 | wset_top_line (w, make_number (0)); | 5796 | w->top_line = 0; |
| 5805 | 5797 | ||
| 5806 | if (CONSP (Vx_max_tooltip_size) | 5798 | if (CONSP (Vx_max_tooltip_size) |
| 5807 | && INTEGERP (XCAR (Vx_max_tooltip_size)) | 5799 | && INTEGERP (XCAR (Vx_max_tooltip_size)) |
| @@ -5809,22 +5801,22 @@ Text larger than the specified size is clipped. */) | |||
| 5809 | && INTEGERP (XCDR (Vx_max_tooltip_size)) | 5801 | && INTEGERP (XCDR (Vx_max_tooltip_size)) |
| 5810 | && XINT (XCDR (Vx_max_tooltip_size)) > 0) | 5802 | && XINT (XCDR (Vx_max_tooltip_size)) > 0) |
| 5811 | { | 5803 | { |
| 5812 | wset_total_cols (w, XCAR (Vx_max_tooltip_size)); | 5804 | w->total_cols = XFASTINT (XCAR (Vx_max_tooltip_size)); |
| 5813 | wset_total_lines (w, XCDR (Vx_max_tooltip_size)); | 5805 | w->total_lines = XFASTINT (XCDR (Vx_max_tooltip_size)); |
| 5814 | } | 5806 | } |
| 5815 | else | 5807 | else |
| 5816 | { | 5808 | { |
| 5817 | wset_total_cols (w, make_number (80)); | 5809 | w->total_cols = 80; |
| 5818 | wset_total_lines (w, make_number (40)); | 5810 | w->total_lines = 40; |
| 5819 | } | 5811 | } |
| 5820 | 5812 | ||
| 5821 | FRAME_TOTAL_COLS (f) = XINT (w->total_cols); | 5813 | FRAME_TOTAL_COLS (f) = WINDOW_TOTAL_COLS (w); |
| 5822 | adjust_glyphs (f); | 5814 | adjust_glyphs (f); |
| 5823 | w->pseudo_window_p = 1; | 5815 | w->pseudo_window_p = 1; |
| 5824 | 5816 | ||
| 5825 | /* Display the tooltip text in a temporary buffer. */ | 5817 | /* Display the tooltip text in a temporary buffer. */ |
| 5826 | old_buffer = current_buffer; | 5818 | old_buffer = current_buffer; |
| 5827 | set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); | 5819 | set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->contents)); |
| 5828 | bset_truncate_lines (current_buffer, Qnil); | 5820 | bset_truncate_lines (current_buffer, Qnil); |
| 5829 | clear_glyph_matrix (w->desired_matrix); | 5821 | clear_glyph_matrix (w->desired_matrix); |
| 5830 | clear_glyph_matrix (w->current_matrix); | 5822 | clear_glyph_matrix (w->current_matrix); |
| @@ -5840,7 +5832,7 @@ Text larger than the specified size is clipped. */) | |||
| 5840 | int row_width; | 5832 | int row_width; |
| 5841 | 5833 | ||
| 5842 | /* Stop at the first empty row at the end. */ | 5834 | /* Stop at the first empty row at the end. */ |
| 5843 | if (!row->enabled_p || !row->displays_text_p) | 5835 | if (!row->enabled_p || !MATRIX_ROW_DISPLAYS_TEXT_P (row)) |
| 5844 | break; | 5836 | break; |
| 5845 | 5837 | ||
| 5846 | /* Let the row go over the full width of the frame. */ | 5838 | /* Let the row go over the full width of the frame. */ |
| @@ -5886,7 +5878,7 @@ Text larger than the specified size is clipped. */) | |||
| 5886 | /* w->total_cols and FRAME_TOTAL_COLS want the width in columns, | 5878 | /* w->total_cols and FRAME_TOTAL_COLS want the width in columns, |
| 5887 | not in pixels. */ | 5879 | not in pixels. */ |
| 5888 | width /= WINDOW_FRAME_COLUMN_WIDTH (w); | 5880 | width /= WINDOW_FRAME_COLUMN_WIDTH (w); |
| 5889 | wset_total_cols (w, make_number (width)); | 5881 | w->total_cols = width; |
| 5890 | FRAME_TOTAL_COLS (f) = width; | 5882 | FRAME_TOTAL_COLS (f) = width; |
| 5891 | adjust_glyphs (f); | 5883 | adjust_glyphs (f); |
| 5892 | w->pseudo_window_p = 1; | 5884 | w->pseudo_window_p = 1; |
| @@ -5901,7 +5893,7 @@ Text larger than the specified size is clipped. */) | |||
| 5901 | struct glyph *last; | 5893 | struct glyph *last; |
| 5902 | int row_width; | 5894 | int row_width; |
| 5903 | 5895 | ||
| 5904 | if (!row->enabled_p || !row->displays_text_p) | 5896 | if (!row->enabled_p || !MATRIX_ROW_DISPLAYS_TEXT_P (row)) |
| 5905 | break; | 5897 | break; |
| 5906 | row->full_width_p = 1; | 5898 | row->full_width_p = 1; |
| 5907 | row_width = row->pixel_width; | 5899 | row_width = row->pixel_width; |
| @@ -5954,7 +5946,7 @@ Text larger than the specified size is clipped. */) | |||
| 5954 | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); | 5946 | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); |
| 5955 | 5947 | ||
| 5956 | /* Let redisplay know that we have made the frame visible already. */ | 5948 | /* Let redisplay know that we have made the frame visible already. */ |
| 5957 | f->async_visible = 1; | 5949 | SET_FRAME_VISIBLE (f, 1); |
| 5958 | 5950 | ||
| 5959 | ShowWindow (FRAME_W32_WINDOW (f), SW_SHOWNOACTIVATE); | 5951 | ShowWindow (FRAME_W32_WINDOW (f), SW_SHOWNOACTIVATE); |
| 5960 | } | 5952 | } |
| @@ -6022,20 +6014,12 @@ Value is t if tooltip was open, nil otherwise. */) | |||
| 6022 | #define FILE_NAME_COMBO_BOX cmb13 | 6014 | #define FILE_NAME_COMBO_BOX cmb13 |
| 6023 | #define FILE_NAME_LIST lst1 | 6015 | #define FILE_NAME_LIST lst1 |
| 6024 | 6016 | ||
| 6025 | #ifdef NTGUI_UNICODE | ||
| 6026 | #define GUISTR(x) (L ## x) | ||
| 6027 | typedef wchar_t guichar_t; | ||
| 6028 | #else /* !NTGUI_UNICODE */ | ||
| 6029 | #define GUISTR(x) x | ||
| 6030 | typedef char guichar_t; | ||
| 6031 | #endif /* NTGUI_UNICODE */ | ||
| 6032 | |||
| 6033 | /* Callback for altering the behavior of the Open File dialog. | 6017 | /* Callback for altering the behavior of the Open File dialog. |
| 6034 | Makes the Filename text field contain "Current Directory" and be | 6018 | Makes the Filename text field contain "Current Directory" and be |
| 6035 | read-only when "Directories" is selected in the filter. This | 6019 | read-only when "Directories" is selected in the filter. This |
| 6036 | allows us to work around the fact that the standard Open File | 6020 | allows us to work around the fact that the standard Open File |
| 6037 | dialog does not support directories. */ | 6021 | dialog does not support directories. */ |
| 6038 | static UINT CALLBACK | 6022 | static UINT_PTR CALLBACK |
| 6039 | file_dialog_callback (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | 6023 | file_dialog_callback (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) |
| 6040 | { | 6024 | { |
| 6041 | if (msg == WM_NOTIFY) | 6025 | if (msg == WM_NOTIFY) |
| @@ -6246,11 +6230,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 6246 | block_input (); | 6230 | block_input (); |
| 6247 | file_details->lpfnHook = file_dialog_callback; | 6231 | file_details->lpfnHook = file_dialog_callback; |
| 6248 | 6232 | ||
| 6249 | #ifdef NTGUI_UNICODE | 6233 | file_opened = GUI_FN (GetOpenFileName) (file_details); |
| 6250 | file_opened = GetOpenFileNameW (file_details); | ||
| 6251 | #else /* !NTGUI_UNICODE */ | ||
| 6252 | file_opened = GetOpenFileNameA (file_details); | ||
| 6253 | #endif /* NTGUI_UNICODE */ | ||
| 6254 | unblock_input (); | 6234 | unblock_input (); |
| 6255 | unbind_to (count, Qnil); | 6235 | unbind_to (count, Qnil); |
| 6256 | } | 6236 | } |
| @@ -6259,13 +6239,9 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 6259 | { | 6239 | { |
| 6260 | /* Get an Emacs string from the value Windows gave us. */ | 6240 | /* Get an Emacs string from the value Windows gave us. */ |
| 6261 | #ifdef NTGUI_UNICODE | 6241 | #ifdef NTGUI_UNICODE |
| 6262 | filename = from_unicode ( | 6242 | filename = from_unicode_buffer (filename_buf); |
| 6263 | make_unibyte_string ( | ||
| 6264 | (char*) filename_buf, | ||
| 6265 | /* we get one of the two final 0 bytes for free. */ | ||
| 6266 | 1 + sizeof (wchar_t) * wcslen (filename_buf))); | ||
| 6267 | #else /* !NTGUI_UNICODE */ | 6243 | #else /* !NTGUI_UNICODE */ |
| 6268 | dostounix_filename (filename_buf); | 6244 | dostounix_filename (filename_buf, 0); |
| 6269 | filename = DECODE_FILE (build_string (filename_buf)); | 6245 | filename = DECODE_FILE (build_string (filename_buf)); |
| 6270 | #endif /* NTGUI_UNICODE */ | 6246 | #endif /* NTGUI_UNICODE */ |
| 6271 | 6247 | ||
| @@ -6437,20 +6413,29 @@ an integer representing a ShowWindow flag: | |||
| 6437 | CHECK_STRING (document); | 6413 | CHECK_STRING (document); |
| 6438 | 6414 | ||
| 6439 | /* Encode filename, current directory and parameters. */ | 6415 | /* Encode filename, current directory and parameters. */ |
| 6440 | current_dir = ENCODE_FILE (BVAR (current_buffer, directory)); | 6416 | current_dir = BVAR (current_buffer, directory); |
| 6441 | document = ENCODE_FILE (document); | 6417 | |
| 6418 | #ifdef CYGWIN | ||
| 6419 | current_dir = Fcygwin_convert_file_name_to_windows (current_dir, Qt); | ||
| 6420 | if (STRINGP (document)) | ||
| 6421 | document = Fcygwin_convert_file_name_to_windows (document, Qt); | ||
| 6422 | #endif /* CYGWIN */ | ||
| 6423 | |||
| 6424 | current_dir = GUI_ENCODE_FILE (current_dir); | ||
| 6425 | if (STRINGP (document)) | ||
| 6426 | document = GUI_ENCODE_FILE (document); | ||
| 6442 | if (STRINGP (parameters)) | 6427 | if (STRINGP (parameters)) |
| 6443 | parameters = ENCODE_SYSTEM (parameters); | 6428 | parameters = GUI_ENCODE_SYSTEM (parameters); |
| 6444 | 6429 | ||
| 6445 | if ((int) ShellExecute (NULL, | 6430 | if ((int) GUI_FN (ShellExecute) (NULL, |
| 6446 | (STRINGP (operation) ? | 6431 | (STRINGP (operation) ? |
| 6447 | SDATA (operation) : NULL), | 6432 | GUI_SDATA (operation) : NULL), |
| 6448 | SDATA (document), | 6433 | GUI_SDATA (document), |
| 6449 | (STRINGP (parameters) ? | 6434 | (STRINGP (parameters) ? |
| 6450 | SDATA (parameters) : NULL), | 6435 | GUI_SDATA (parameters) : NULL), |
| 6451 | SDATA (current_dir), | 6436 | GUI_SDATA (current_dir), |
| 6452 | (INTEGERP (show_flag) ? | 6437 | (INTEGERP (show_flag) ? |
| 6453 | XINT (show_flag) : SW_SHOWDEFAULT)) | 6438 | XINT (show_flag) : SW_SHOWDEFAULT)) |
| 6454 | > 32) | 6439 | > 32) |
| 6455 | return Qt; | 6440 | return Qt; |
| 6456 | errstr = w32_strerror (0); | 6441 | errstr = w32_strerror (0); |
| @@ -6495,12 +6480,12 @@ w32_parse_hot_key (Lisp_Object key) | |||
| 6495 | 6480 | ||
| 6496 | CHECK_VECTOR (key); | 6481 | CHECK_VECTOR (key); |
| 6497 | 6482 | ||
| 6498 | if (XFASTINT (Flength (key)) != 1) | 6483 | if (ASIZE (key) != 1) |
| 6499 | return Qnil; | 6484 | return Qnil; |
| 6500 | 6485 | ||
| 6501 | GCPRO1 (key); | 6486 | GCPRO1 (key); |
| 6502 | 6487 | ||
| 6503 | c = Faref (key, make_number (0)); | 6488 | c = AREF (key, 0); |
| 6504 | 6489 | ||
| 6505 | if (CONSP (c) && lucid_event_type_list_p (c)) | 6490 | if (CONSP (c) && lucid_event_type_list_p (c)) |
| 6506 | c = Fevent_convert_list (c); | 6491 | c = Fevent_convert_list (c); |
| @@ -6819,6 +6804,7 @@ The following %-sequences are provided: | |||
| 6819 | } | 6804 | } |
| 6820 | 6805 | ||
| 6821 | 6806 | ||
| 6807 | #ifdef WINDOWSNT | ||
| 6822 | DEFUN ("file-system-info", Ffile_system_info, Sfile_system_info, 1, 1, 0, | 6808 | DEFUN ("file-system-info", Ffile_system_info, Sfile_system_info, 1, 1, 0, |
| 6823 | doc: /* Return storage information about the file system FILENAME is on. | 6809 | doc: /* Return storage information about the file system FILENAME is on. |
| 6824 | Value is a list of floats (TOTAL FREE AVAIL), where TOTAL is the total | 6810 | Value is a list of floats (TOTAL FREE AVAIL), where TOTAL is the total |
| @@ -6914,6 +6900,8 @@ If the underlying system call fails, value is nil. */) | |||
| 6914 | 6900 | ||
| 6915 | return value; | 6901 | return value; |
| 6916 | } | 6902 | } |
| 6903 | #endif /* WINDOWSNT */ | ||
| 6904 | |||
| 6917 | 6905 | ||
| 6918 | DEFUN ("default-printer-name", Fdefault_printer_name, Sdefault_printer_name, | 6906 | DEFUN ("default-printer-name", Fdefault_printer_name, Sdefault_printer_name, |
| 6919 | 0, 0, 0, doc: /* Return the name of Windows default printer device. */) | 6907 | 0, 0, 0, doc: /* Return the name of Windows default printer device. */) |
| @@ -7037,6 +7025,9 @@ cache_system_info (void) | |||
| 7037 | DWORD data; | 7025 | DWORD data; |
| 7038 | } version; | 7026 | } version; |
| 7039 | 7027 | ||
| 7028 | /* Cache the module handle of Emacs itself. */ | ||
| 7029 | hinst = GetModuleHandle (NULL); | ||
| 7030 | |||
| 7040 | /* Cache the version of the operating system. */ | 7031 | /* Cache the version of the operating system. */ |
| 7041 | version.data = GetVersion (); | 7032 | version.data = GetVersion (); |
| 7042 | w32_major_version = version.info.major; | 7033 | w32_major_version = version.info.major; |
| @@ -7049,7 +7040,7 @@ cache_system_info (void) | |||
| 7049 | 7040 | ||
| 7050 | /* Cache page size, allocation unit, processor type, etc. */ | 7041 | /* Cache page size, allocation unit, processor type, etc. */ |
| 7051 | GetSystemInfo (&sysinfo_cache); | 7042 | GetSystemInfo (&sysinfo_cache); |
| 7052 | syspage_mask = sysinfo_cache.dwPageSize - 1; | 7043 | syspage_mask = (DWORD_PTR)sysinfo_cache.dwPageSize - 1; |
| 7053 | 7044 | ||
| 7054 | /* Cache os info. */ | 7045 | /* Cache os info. */ |
| 7055 | osinfo_cache.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); | 7046 | osinfo_cache.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); |
| @@ -7637,7 +7628,10 @@ only be necessary if the default setting causes problems. */); | |||
| 7637 | defsubr (&Sw32_window_exists_p); | 7628 | defsubr (&Sw32_window_exists_p); |
| 7638 | defsubr (&Sw32_battery_status); | 7629 | defsubr (&Sw32_battery_status); |
| 7639 | 7630 | ||
| 7631 | #ifdef WINDOWSNT | ||
| 7640 | defsubr (&Sfile_system_info); | 7632 | defsubr (&Sfile_system_info); |
| 7633 | #endif | ||
| 7634 | |||
| 7641 | defsubr (&Sdefault_printer_name); | 7635 | defsubr (&Sdefault_printer_name); |
| 7642 | defsubr (&Sset_message_beep); | 7636 | defsubr (&Sset_message_beep); |
| 7643 | 7637 | ||
| @@ -7783,6 +7777,9 @@ emacs_abort (void) | |||
| 7783 | #endif | 7777 | #endif |
| 7784 | if (stderr_fd >= 0) | 7778 | if (stderr_fd >= 0) |
| 7785 | write (stderr_fd, "\r\nBacktrace:\r\n", 14); | 7779 | write (stderr_fd, "\r\nBacktrace:\r\n", 14); |
| 7780 | #ifdef CYGWIN | ||
| 7781 | #define _open open | ||
| 7782 | #endif | ||
| 7786 | errfile_fd = _open ("emacs_backtrace.txt", O_RDWR | O_CREAT | O_BINARY, S_IREAD | S_IWRITE); | 7783 | errfile_fd = _open ("emacs_backtrace.txt", O_RDWR | O_CREAT | O_BINARY, S_IREAD | S_IWRITE); |
| 7787 | if (errfile_fd >= 0) | 7784 | if (errfile_fd >= 0) |
| 7788 | { | 7785 | { |
| @@ -7797,7 +7794,7 @@ emacs_abort (void) | |||
| 7797 | /* stack[] gives the return addresses, whereas we want | 7794 | /* stack[] gives the return addresses, whereas we want |
| 7798 | the address of the call, so decrease each address | 7795 | the address of the call, so decrease each address |
| 7799 | by approximate size of 1 CALL instruction. */ | 7796 | by approximate size of 1 CALL instruction. */ |
| 7800 | sprintf (buf, "0x%p\r\n", stack[j] - sizeof(void *)); | 7797 | sprintf (buf, "0x%p\r\n", (char *)stack[j] - sizeof(void *)); |
| 7801 | if (stderr_fd >= 0) | 7798 | if (stderr_fd >= 0) |
| 7802 | write (stderr_fd, buf, strlen (buf)); | 7799 | write (stderr_fd, buf, strlen (buf)); |
| 7803 | if (errfile_fd >= 0) | 7800 | if (errfile_fd >= 0) |
| @@ -7818,3 +7815,15 @@ emacs_abort (void) | |||
| 7818 | } | 7815 | } |
| 7819 | } | 7816 | } |
| 7820 | } | 7817 | } |
| 7818 | |||
| 7819 | #ifdef NTGUI_UNICODE | ||
| 7820 | |||
| 7821 | Lisp_Object | ||
| 7822 | ntgui_encode_system (Lisp_Object str) | ||
| 7823 | { | ||
| 7824 | Lisp_Object encoded; | ||
| 7825 | to_unicode (str, &encoded); | ||
| 7826 | return encoded; | ||
| 7827 | } | ||
| 7828 | |||
| 7829 | #endif /* NTGUI_UNICODE */ | ||