fixed fullscreen function

This commit is contained in:
fenze 2022-05-11 02:53:43 +02:00
parent 701c61d489
commit 8df9b661dc
2 changed files with 5 additions and 10 deletions

View File

@ -13,6 +13,5 @@ static Key keys[] = {
{ MODKEY, GDK_KEY_y, copy_url }, { MODKEY, GDK_KEY_y, copy_url },
{ MODKEY, GDK_KEY_p, paste_url }, { MODKEY, GDK_KEY_p, paste_url },
{ 0, GDK_KEY_F11, fullscreen }, { 0, GDK_KEY_F11, fullscreen },
{ MODKEY|SHIFT, GDK_KEY_i, inspector },
{ MODKEY, GDK_KEY_e, search } { MODKEY, GDK_KEY_e, search }
}; };

View File

@ -14,7 +14,6 @@ struct _RoseWindow {
WebKitWebView *webview; WebKitWebView *webview;
GHashTable *action_groups; GHashTable *action_groups;
GHashTable *action_labels; GHashTable *action_labels;
/* RoseGestureController *mouse_gesture_controller; */
}; };
enum { enum {
@ -40,6 +39,7 @@ static gboolean key_press_callback(RoseWindow *window,
guint keycode, guint keycode,
GdkModifierType state) GdkModifierType state)
{ {
for (int i = 0; i < LENGTH(keys); i++) { for (int i = 0; i < LENGTH(keys); i++) {
if (keys[i].modkey == state if (keys[i].modkey == state
&& keys[i].keycod == keyval) { && keys[i].keycod == keyval) {
@ -63,13 +63,10 @@ static gboolean key_press_callback(RoseWindow *window,
gdk_clipboard_read_text_async(clipboard, NULL, read_clipboard, window->webview); gdk_clipboard_read_text_async(clipboard, NULL, read_clipboard, window->webview);
} break; } break;
case fullscreen: case fullscreen:
if (gtk_window_is_fullscreen(window->window)) if (gtk_window_is_fullscreen(GTK_WINDOW(gtk_widget_get_root(GTK_WIDGET(window->webview)))))
gtk_window_unfullscreen(GTK_WINDOW(window->window)); gtk_window_unfullscreen(GTK_WINDOW(gtk_widget_get_root(GTK_WIDGET(window->webview))));
else else
gtk_window_fullscreen(GTK_WINDOW(window->window)); gtk_window_fullscreen(GTK_WINDOW(gtk_widget_get_root(GTK_WIDGET(window->webview))));
break;
case inspector:
puts("wqf");
break; break;
case search: { case search: {
int id = fork(); int id = fork();
@ -108,7 +105,6 @@ static void rose_window_init(RoseWindow *window)
guint rose_window_show(GtkApplication *app, RoseWindow *window) guint rose_window_show(GtkApplication *app, RoseWindow *window)
{ {
GtkWidget *w = gtk_application_window_new(app); GtkWidget *w = gtk_application_window_new(app);
window->window = GTK_WINDOW(w);
GtkWidget *webview = rose_webview_new(); GtkWidget *webview = rose_webview_new();
window->webview = WEBKIT_WEB_VIEW(webview); window->webview = WEBKIT_WEB_VIEW(webview);