Remove unused dependency, fix searchbar flashing

This commit is contained in:
fenze 2022-11-15 10:06:11 +01:00
parent 369d73c7d8
commit 68ca1eb61a
3 changed files with 11 additions and 10 deletions

View File

@ -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[@]}`

View File

@ -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"

13
rose.c
View File

@ -10,10 +10,7 @@
* Author: fenze <contact@fenze.dev>
*/
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <webkit2/webkit2.h>
#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();
}