Changeset 221833 in webkit
- Timestamp:
- Sep 10, 2017 2:54:31 AM (7 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r221829 r221833 1 2017-09-10 Michael Catanzaro <mcatanzaro@igalia.com> 2 3 [GTK] Improve Ctrl+W and Ctrl+Q shortcuts in MiniBrowser 4 https://bugs.webkit.org/show_bug.cgi?id=176619 5 6 Reviewed by Carlos Garcia Campos. 7 8 There are two different problems here. First, Ctrl+W is closing the entire window. That made 9 sense when I implemented the shortcut a couple years ago, but now MiniBrowser supports tabs 10 and it should really close only one single tab. Fix that. 11 12 Next, the keyboard shortcuts are not using webkit_web_view_try_close() and so are bypassing 13 onbeforeunload handlers, which are respected when closing with the mouse. Fix that too. 14 15 * MiniBrowser/gtk/BrowserWindow.c: 16 (browserWindowTryCloseCurrentWebView): 17 (browserWindowTryClose): 18 (browser_window_init): 19 1 20 2017-09-07 Myles C. Maxfield <mmaxfield@apple.com> 2 21 -
trunk/Tools/MiniBrowser/gtk/BrowserWindow.c
r221827 r221833 255 255 } 256 256 257 static void browserWindowTryCloseCurrentWebView(BrowserWindow *window) 258 { 259 int currentPage = gtk_notebook_get_current_page(GTK_NOTEBOOK(window->notebook)); 260 BrowserTab *tab = (BrowserTab *)gtk_notebook_get_nth_page(GTK_NOTEBOOK(window->notebook), currentPage); 261 webkit_web_view_try_close(browser_tab_get_web_view(tab)); 262 } 263 264 static void browserWindowTryClose(BrowserWindow *window) 265 { 266 GSList *webViews = NULL; 267 int n = gtk_notebook_get_n_pages(GTK_NOTEBOOK(window->notebook)); 268 int i; 269 270 for (i = 0; i < n; ++i) { 271 BrowserTab *tab = (BrowserTab *)gtk_notebook_get_nth_page(GTK_NOTEBOOK(window->notebook), i); 272 webViews = g_slist_prepend(webViews, browser_tab_get_web_view(tab)); 273 } 274 275 GSList *link; 276 for (link = webViews; link; link = link->next) 277 webkit_web_view_try_close(link->data); 278 } 279 257 280 static void backForwardlistChanged(WebKitBackForwardList *backForwardlist, WebKitBackForwardListItem *itemAdded, GList *itemsRemoved, BrowserWindow *window) 258 281 { … … 934 957 /* Quit */ 935 958 gtk_accel_group_connect(window->accelGroup, GDK_KEY_Q, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE, 936 g_cclosure_new_swap(G_CALLBACK( gtk_widget_destroy), window, NULL));959 g_cclosure_new_swap(G_CALLBACK(browserWindowTryClose), window, NULL)); 937 960 gtk_accel_group_connect(window->accelGroup, GDK_KEY_W, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE, 938 g_cclosure_new_swap(G_CALLBACK( gtk_widget_destroy), window, NULL));961 g_cclosure_new_swap(G_CALLBACK(browserWindowTryCloseCurrentWebView), window, NULL)); 939 962 940 963 /* Print */ … … 1046 1069 } 1047 1070 1048 static void browserWindowTryClose(BrowserWindow *window)1049 {1050 GSList *webViews = NULL;1051 int n = gtk_notebook_get_n_pages(GTK_NOTEBOOK(window->notebook));1052 int i;1053 1054 for (i = 0; i < n; ++i) {1055 BrowserTab *tab = (BrowserTab *)gtk_notebook_get_nth_page(GTK_NOTEBOOK(window->notebook), i);1056 webViews = g_slist_prepend(webViews, browser_tab_get_web_view(tab));1057 }1058 1059 GSList *link;1060 for (link = webViews; link; link = link->next)1061 webkit_web_view_try_close(link->data);1062 }1063 1064 1071 static gboolean browserWindowDeleteEvent(GtkWidget *widget, GdkEventAny* event) 1065 1072 {
Note: See TracChangeset
for help on using the changeset viewer.