Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: Jiří Techet techet@gmail.com Date: Tue, 11 Jun 2024 11:06:44 UTC Commit: f1a2870609d855c4ba3acbfc341bb314cc96b687 https://github.com/geany/geany/commit/f1a2870609d855c4ba3acbfc341bb314cc96b6...
Log Message: ----------- Remove some more win32 code that was previously used by native dialogs
Modified Paths: -------------- src/win32.c
Modified: src/win32.c 121 lines changed, 0 insertions(+), 121 deletions(-) =================================================================== @@ -60,127 +60,6 @@ #include <gdk/gdkwin32.h>
-/* The timer handle used to refresh windows below modal native dialogs. If - * ever more than one dialog can be shown at a time, this needs to be changed - * to be for specific dialogs. */ -static UINT_PTR dialog_timer = 0; - - -G_INLINE_FUNC void win32_dialog_reset_timer(HWND hwnd) -{ - if (G_UNLIKELY(dialog_timer != 0)) - { - KillTimer(hwnd, dialog_timer); - dialog_timer = 0; - } -} - - -static VOID CALLBACK -win32_dialog_update_main_window(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) -{ - gint i; - - /* Pump the main window loop a bit, but not enough to lock-up. - * The typical `while(gtk_events_pending()) gtk_main_iteration();` - * loop causes the entire operating system to lock-up. */ - for (i = 0; i < 4 && gtk_events_pending(); i++) - gtk_main_iteration(); - - /* Cancel any pending timers since we just did an update */ - win32_dialog_reset_timer(hwnd); -} - - -G_INLINE_FUNC UINT_PTR win32_dialog_queue_main_window_redraw(HWND dlg, UINT msg, - WPARAM wParam, LPARAM lParam, gboolean postpone) -{ - switch (msg) - { - /* Messages that likely mean the window below a dialog needs to be re-drawn. */ - case WM_WINDOWPOSCHANGED: - case WM_MOVE: - case WM_SIZE: - case WM_THEMECHANGED: - if (postpone) - { - win32_dialog_reset_timer(dlg); - dialog_timer = SetTimer(dlg, 0, 33 /* around 30fps */, win32_dialog_update_main_window); - } - else - win32_dialog_update_main_window(dlg, msg, wParam, lParam); - break; - } - return 0; /* always let the default proc handle it */ -} - - -/* This function is called for OPENFILENAME lpfnHook function and it establishes - * a timer that is reset each time which will update the main window loop eventually. */ -static UINT_PTR CALLBACK win32_dialog_explorer_hook_proc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - return win32_dialog_queue_main_window_redraw(dlg, msg, wParam, lParam, TRUE); -} - - -/* This function is called for old-school win32 dialogs that accept a proper - * lpfnHook function for all messages, it doesn't use a timer. */ -static UINT_PTR CALLBACK win32_dialog_hook_proc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - return win32_dialog_queue_main_window_redraw(dlg, msg, wParam, lParam, FALSE); -} - - -/* Converts the given UTF-8 filename or directory name into something usable for Windows and - * returns the directory part of the given filename. */ -static wchar_t *get_dir_for_path(const gchar *utf8_filename) -{ - static wchar_t w_dir[MAX_PATH]; - gchar *result; - - if (g_file_test(utf8_filename, G_FILE_TEST_IS_DIR)) - result = (gchar*) utf8_filename; - else - result = g_path_get_dirname(utf8_filename); - - MultiByteToWideChar(CP_UTF8, 0, result, -1, w_dir, G_N_ELEMENTS(w_dir)); - - if (result != utf8_filename) - g_free(result); - - return w_dir; -} - - -/* Callback function for setting the initial directory of the folder open dialog. This could also - * be done with BROWSEINFO.pidlRoot and SHParseDisplayName but SHParseDisplayName is not available - * on systems below Windows XP. So, we go the hard way by creating a callback which will set up the - * folder when the dialog is initialised. Yeah, I like Windows. */ -static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData) -{ - win32_dialog_hook_proc(hwnd, uMsg, lp, pData); - switch (uMsg) - { - case BFFM_INITIALIZED: - { - SendMessageW(hwnd, BFFM_SETSELECTIONW, TRUE, pData); - break; - } - case BFFM_SELCHANGED: - { - /* set the status window to the currently selected path. */ - static wchar_t szDir[MAX_PATH]; - if (SHGetPathFromIDListW((LPITEMIDLIST) lp, szDir)) - { - SendMessageW(hwnd, BFFM_SETSTATUSTEXTW, 0, (LPARAM) szDir); - } - break; - } - } - return 0; -} - - /* Creates a native Windows message box of the given type and returns always TRUE * or FALSE representing th pressed Yes or No button. * If type is not GTK_MESSAGE_QUESTION, it returns always TRUE. */
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).