From 68ca1eb61abd8f3a14664e3c6d58a3419fe194f7 Mon Sep 17 00:00:00 2001 From: fenze Date: Tue, 15 Nov 2022 10:06:11 +0100 Subject: [PATCH] Remove unused dependency, fix searchbar flashing --- build.sh | 2 +- config.h | 6 ++++-- rose.c | 13 ++++++------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/build.sh b/build.sh index 00118e4..9bb339f 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ CC=clang SRC=rose.c -DEPS=('webkit2gtk-4.0' 'libadwaita-1') +DEPS=('webkit2gtk-4.0') INCS=`pkg-config --cflags ${DEPS[@]}` LIBS=`pkg-config --libs ${DEPS[@]}` diff --git a/config.h b/config.h index cd2897c..762c1d6 100644 --- a/config.h +++ b/config.h @@ -15,10 +15,12 @@ /* See more: https://webkitgtk.org/reference/webkit2gtk/stable/class.Settings.html */ #define WEBKIT \ "enable-back-forward-navigation-gestures", true, \ - "enable-developer-extras", true + "enable-developer-extras", true, \ + "enable-smooth-scrolling", false #define GTK \ - "gtk-application-prefer-dark-theme", true + "gtk-application-prefer-dark-theme", true, \ + "gtk-enable-animations", false #define HOME "https://duckduckgo.com" #define SEARCH "https://duckduckgo.com/?q=%s" diff --git a/rose.c b/rose.c index 3f41071..2b6a2d1 100644 --- a/rose.c +++ b/rose.c @@ -10,10 +10,7 @@ * Author: fenze */ -#include -#include #include - #include "config.h" #define CACHE \ @@ -32,7 +29,6 @@ enum { _SEARCH, _FIND }; - static int entry_mode; static GtkWindow *window; static GtkHeaderBar *bar; @@ -125,7 +121,8 @@ void notebook_append(GtkNotebook *notebook, const char *uri) int n = gtk_notebook_append_page(notebook, GTK_WIDGET(view), NULL); gtk_notebook_set_tab_reorderable(notebook, GTK_WIDGET(view), true); gtk_widget_show_all(GTK_WIDGET(window)); - webkit_web_view_set_background_color (view, &rgba); + gtk_widget_hide(GTK_WIDGET(bar)); + webkit_web_view_set_background_color(view, rgba); load_uri(view, (uri) ? uri : HOME); gtk_notebook_set_current_page(notebook, n); } @@ -299,7 +296,8 @@ int keypress(void *self, GdkEvent *e, GtkNotebook *notebook) void search_activate(GtkEntry *self, GtkNotebook *notebook) { if (entry_mode == _SEARCH) - load_uri(notebook_get_webview(notebook), gtk_entry_buffer_get_text(search_buf)); + load_uri(notebook_get_webview(notebook), + gtk_entry_buffer_get_text(search_buf)); else if (entry_mode == _FIND) webkit_find_controller_search( webkit_web_view_get_find_controller( @@ -352,6 +350,8 @@ void setup(GtkNotebook *notebook, const char* uri) window_init(notebook); notebook_init(notebook, uri); + g_object_set(gtk_settings_get_default(), GTK, NULL); + gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(notebook)); gtk_widget_show_all(GTK_WIDGET(window)); gtk_widget_hide(GTK_WIDGET(bar)); @@ -361,7 +361,6 @@ int main(int argc, char **argv) { GtkNotebook *notebook; gtk_init(NULL, NULL); - g_object_set(gtk_settings_get_default(), GTK, NULL); setup(notebook, argc > 1 ? argv[1] : NULL); gtk_main(); }