Mercurial > vim
comparison src/gui_w32.c @ 12477:68d7bc045dbe v8.0.1118
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
commit https://github.com/vim/vim/commit/4033c55eca575777718c0701e26635a0cc47d907
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 16 20:54:51 2017 +0200
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Problem: FEAT_WINDOWS adds a lot of #ifdefs while it is nearly always
enabled and only adds 7% to the binary size of the tiny build.
Solution: Graduate FEAT_WINDOWS.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 16 Sep 2017 21:00:06 +0200 |
parents | 2a8890b80923 |
children | 3ca08bf99396 |
comparison
equal
deleted
inserted
replaced
12476:2516383741e6 | 12477:68d7bc045dbe |
---|---|
2945 /* we call gui_focus_change() in _OnSetFocus() */ | 2945 /* we call gui_focus_change() in _OnSetFocus() */ |
2946 /* gui_focus_change((int)fActivate); */ | 2946 /* gui_focus_change((int)fActivate); */ |
2947 return MyWindowProc(hwnd, WM_ACTIVATEAPP, fActivate, (DWORD)dwThreadId); | 2947 return MyWindowProc(hwnd, WM_ACTIVATEAPP, fActivate, (DWORD)dwThreadId); |
2948 } | 2948 } |
2949 | 2949 |
2950 #if defined(FEAT_WINDOWS) || defined(PROTO) | |
2951 void | 2950 void |
2952 gui_mch_destroy_scrollbar(scrollbar_T *sb) | 2951 gui_mch_destroy_scrollbar(scrollbar_T *sb) |
2953 { | 2952 { |
2954 DestroyWindow(sb->id); | 2953 DestroyWindow(sb->id); |
2955 } | 2954 } |
2956 #endif | |
2957 | 2955 |
2958 /* | 2956 /* |
2959 * Get current mouse coordinates in text window. | 2957 * Get current mouse coordinates in text window. |
2960 */ | 2958 */ |
2961 void | 2959 void |
3783 static void | 3781 static void |
3784 _OnDropFiles( | 3782 _OnDropFiles( |
3785 HWND hwnd UNUSED, | 3783 HWND hwnd UNUSED, |
3786 HDROP hDrop) | 3784 HDROP hDrop) |
3787 { | 3785 { |
3788 #ifdef FEAT_WINDOWS | 3786 #define BUFPATHLEN _MAX_PATH |
3789 # define BUFPATHLEN _MAX_PATH | 3787 #define DRAGQVAL 0xFFFFFFFF |
3790 # define DRAGQVAL 0xFFFFFFFF | 3788 #ifdef FEAT_MBYTE |
3791 # ifdef FEAT_MBYTE | |
3792 WCHAR wszFile[BUFPATHLEN]; | 3789 WCHAR wszFile[BUFPATHLEN]; |
3793 # endif | 3790 #endif |
3794 char szFile[BUFPATHLEN]; | 3791 char szFile[BUFPATHLEN]; |
3795 UINT cFiles = DragQueryFile(hDrop, DRAGQVAL, NULL, 0); | 3792 UINT cFiles = DragQueryFile(hDrop, DRAGQVAL, NULL, 0); |
3796 UINT i; | 3793 UINT i; |
3797 char_u **fnames; | 3794 char_u **fnames; |
3798 POINT pt; | 3795 POINT pt; |
3809 fnames = (char_u **)alloc(cFiles * sizeof(char_u *)); | 3806 fnames = (char_u **)alloc(cFiles * sizeof(char_u *)); |
3810 | 3807 |
3811 if (fnames != NULL) | 3808 if (fnames != NULL) |
3812 for (i = 0; i < cFiles; ++i) | 3809 for (i = 0; i < cFiles; ++i) |
3813 { | 3810 { |
3814 # ifdef FEAT_MBYTE | 3811 #ifdef FEAT_MBYTE |
3815 if (DragQueryFileW(hDrop, i, wszFile, BUFPATHLEN) > 0) | 3812 if (DragQueryFileW(hDrop, i, wszFile, BUFPATHLEN) > 0) |
3816 fnames[i] = utf16_to_enc(wszFile, NULL); | 3813 fnames[i] = utf16_to_enc(wszFile, NULL); |
3817 else | 3814 else |
3818 # endif | 3815 #endif |
3819 { | 3816 { |
3820 DragQueryFile(hDrop, i, szFile, BUFPATHLEN); | 3817 DragQueryFile(hDrop, i, szFile, BUFPATHLEN); |
3821 fnames[i] = vim_strsave((char_u *)szFile); | 3818 fnames[i] = vim_strsave((char_u *)szFile); |
3822 } | 3819 } |
3823 } | 3820 } |
3835 | 3832 |
3836 gui_handle_drop(pt.x, pt.y, modifiers, fnames, cFiles); | 3833 gui_handle_drop(pt.x, pt.y, modifiers, fnames, cFiles); |
3837 | 3834 |
3838 s_need_activate = TRUE; | 3835 s_need_activate = TRUE; |
3839 } | 3836 } |
3840 #endif | |
3841 } | 3837 } |
3842 | 3838 |
3843 static int | 3839 static int |
3844 _OnScroll( | 3840 _OnScroll( |
3845 HWND hwnd UNUSED, | 3841 HWND hwnd UNUSED, |
5461 #ifdef FEAT_MENU | 5457 #ifdef FEAT_MENU |
5462 s_menuBar = CreateMenu(); | 5458 s_menuBar = CreateMenu(); |
5463 #endif | 5459 #endif |
5464 s_hdc = GetDC(s_textArea); | 5460 s_hdc = GetDC(s_textArea); |
5465 | 5461 |
5466 #ifdef FEAT_WINDOWS | |
5467 DragAcceptFiles(s_hwnd, TRUE); | 5462 DragAcceptFiles(s_hwnd, TRUE); |
5468 #endif | |
5469 | 5463 |
5470 /* Do we need to bother with this? */ | 5464 /* Do we need to bother with this? */ |
5471 /* m_fMouseAvail = GetSystemMetrics(SM_MOUSEPRESENT); */ | 5465 /* m_fMouseAvail = GetSystemMetrics(SM_MOUSEPRESENT); */ |
5472 | 5466 |
5473 /* Get background/foreground colors from the system */ | 5467 /* Get background/foreground colors from the system */ |
5779 | 5773 |
5780 /* Disable langmap */ | 5774 /* Disable langmap */ |
5781 State &= ~LANGMAP; | 5775 State &= ~LANGMAP; |
5782 if (State & INSERT) | 5776 if (State & INSERT) |
5783 { | 5777 { |
5784 #if defined(FEAT_WINDOWS) && defined(FEAT_KEYMAP) | 5778 #if defined(FEAT_KEYMAP) |
5785 /* Unshown 'keymap' in status lines */ | 5779 /* Unshown 'keymap' in status lines */ |
5786 if (curbuf->b_p_iminsert == B_IMODE_LMAP) | 5780 if (curbuf->b_p_iminsert == B_IMODE_LMAP) |
5787 { | 5781 { |
5788 /* Save cursor position */ | 5782 /* Save cursor position */ |
5789 int old_row = gui.row; | 5783 int old_row = gui.row; |