Commit e59fb731 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Merge branch 'release/0.2.8'

parents fe7e9194 d235f5fe
...@@ -8,7 +8,7 @@ tests/girara_test-gtk* ...@@ -8,7 +8,7 @@ tests/girara_test-gtk*
.depend .depend
*.pc *.pc
version.h version.h
css-definitions.c css-definitions.*
*.info *.info
*.gcno *.gcno
*.gcda *.gcda
......
...@@ -88,17 +88,12 @@ ${PROJECTNV}/version.h: ${PROJECTNV}/version.h.in config.mk ...@@ -88,17 +88,12 @@ ${PROJECTNV}/version.h: ${PROJECTNV}/version.h.in config.mk
${PROJECTNV}/version.h.in > ${PROJECTNV}/version.h.tmp ${PROJECTNV}/version.h.in > ${PROJECTNV}/version.h.tmp
$(QUIET)mv ${PROJECTNV}/version.h.tmp ${PROJECTNV}/version.h $(QUIET)mv ${PROJECTNV}/version.h.tmp ${PROJECTNV}/version.h
${PROJECTNV}/css-definitions.c: data/girara-pre-3.20.css_t data/girara-post-3.20.css_t ${PROJECTNV}/css-definitions.%: data/girara-css.gresource.xml config.mk
$(call colorecho,GEN,$@) $(call colorecho,GEN,$@)
$(QUIET)echo '#include "css-definitions.h"' > $@.tmp @mkdir -p ${DEPENDDIR}/$(dir $@)
$(QUIET)echo 'const char* CSS_TEMPLATE_PRE_3_20 =' >> $@.tmp $(QUIET)$(GLIB_COMPILE_RESOURCES) --generate --c-name=girara_css --internal \
$(QUIET)sed 's/^\(.*\)$$/"\1\\n"/' data/girara-pre-3.20.css_t >> $@.tmp --dependency-file=$(DEPENDDIR)/$@.dep \
$(QUIET)echo ';' >> $@.tmp --sourcedir=data --target=$@ data/girara-css.gresource.xml
$(QUIET)echo 'const char* CSS_TEMPLATE_POST_3_20 =' >> $@.tmp
$(QUIET)sed 's/^\(.*\)$$/"\1\\n"/' data/girara-post-3.20.css_t >> $@.tmp
$(QUIET)echo ';' >> $@.tmp
$(QUIET)mv $@.tmp $@
${BUILDDIR}/${PROJECT}.pc: ${PROJECTNV}.pc.in config.mk ${BUILDDIR}/${PROJECT}.pc: ${PROJECTNV}.pc.in config.mk
$(call colorecho,GEN,$(shell basename $@)) $(call colorecho,GEN,$(shell basename $@))
...@@ -117,7 +112,8 @@ ${BUILDDIR}/${PROJECT}.pc: ${PROJECTNV}.pc.in config.mk ...@@ -117,7 +112,8 @@ ${BUILDDIR}/${PROJECT}.pc: ${PROJECTNV}.pc.in config.mk
${OBJECTS}: config.mk \ ${OBJECTS}: config.mk \
${PROJECTNV}/version.h \ ${PROJECTNV}/version.h \
.version-checks/GTK \ .version-checks/GTK \
.version-checks/GLIB .version-checks/GLIB \
${PROJECTNV}/css-definitions.h
${BUILDDIR_RELEASE}/%.o: %.c ${BUILDDIR_RELEASE}/%.o: %.c
$(call colorecho,CC,$<) $(call colorecho,CC,$<)
...@@ -148,7 +144,8 @@ release: ${PROJECT} ...@@ -148,7 +144,8 @@ release: ${PROJECT}
${OBJECT_DEBUG}: config.mk \ ${OBJECT_DEBUG}: config.mk \
${PROJECTNV}/version.h \ ${PROJECTNV}/version.h \
.version-checks/GTK \ .version-checks/GTK \
.version-checks/GLIB .version-checks/GLIB \
${PROJECTNV}/css-definitions.h
${BUILDDIR_DEBUG}/%.o: %.c ${BUILDDIR_DEBUG}/%.o: %.c
$(call colorecho,CC,$<) $(call colorecho,CC,$<)
...@@ -176,6 +173,7 @@ debug: ${PROJECT}-debug ...@@ -176,6 +173,7 @@ debug: ${PROJECT}-debug
${OBJECTS_GCOV}: config.mk \ ${OBJECTS_GCOV}: config.mk \
${PROJECTNV}/version.h \ ${PROJECTNV}/version.h \
${PROJECTNV}/css-definitions.h \
.version-checks/GLIB \ .version-checks/GLIB \
.version-checks/GTK .version-checks/GTK
...@@ -222,7 +220,7 @@ clean: ...@@ -222,7 +220,7 @@ clean:
${PROJECTNV}/version.h \ ${PROJECTNV}/version.h \
${PROJECTNV}/version.h.tmp \ ${PROJECTNV}/version.h.tmp \
${PROJECTNV}/css-definitions.c \ ${PROJECTNV}/css-definitions.c \
${PROJECTNV}/css-definitions.c.tmp ${PROJECTNV}/css-definitions.h
$(QUIET)$(MAKE) -C tests clean $(QUIET)$(MAKE) -C tests clean
$(QUIET)$(MAKE) -C po clean $(QUIET)$(MAKE) -C po clean
$(QUIET)$(MAKE) -C doc clean $(QUIET)$(MAKE) -C doc clean
...@@ -303,7 +301,7 @@ uninstall-headers: ...@@ -303,7 +301,7 @@ uninstall-headers:
format: format:
clang-tidy -fix -checks=readability-braces-around-statements \ clang-tidy -fix -checks=readability-braces-around-statements \
$(SOURCE) -- $(CPPFLAGS) $(CFLAGS) $(SOURCE) -- $(CPPFLAGS) $(CFLAGS)
clang-format-3.8 -i $(SOURCE) $(HEADERS) clang-format -i $(SOURCE) $(HEADERS)
tidy: tidy:
clang-tidy $(SOURCE) -- $(CPPFLAGS) $(CFLAGS) clang-tidy $(SOURCE) -- $(CPPFLAGS) $(CFLAGS)
......
...@@ -5,12 +5,12 @@ and minimalism. It consists of three main components: The view is a widget that ...@@ -5,12 +5,12 @@ and minimalism. It consists of three main components: The view is a widget that
represents the actual application (e.g.: a web site or a document). The input represents the actual application (e.g.: a web site or a document). The input
bar is used to execute commands of the application, while the status bar bar is used to execute commands of the application, while the status bar
notifies the user with current information. It is designed to replace and the notifies the user with current information. It is designed to replace and the
enhance the user interface that is used by zathura and jumanji. enhance the user interface that is used by zathura.
Requirements Requirements
------------ ------------
glib (>= 2.36) glib (>= 2.50)
gtk3 (>= 3.4) gtk3 (>= 3.20)
intltool intltool
libnotify (optional, for notification support) libnotify (optional, for notification support)
jscon-c (optional, for configuration dumping support) jscon-c (optional, for configuration dumping support)
......
...@@ -2,23 +2,26 @@ ...@@ -2,23 +2,26 @@
GIRARA_VERSION_MAJOR = 0 GIRARA_VERSION_MAJOR = 0
GIRARA_VERSION_MINOR = 2 GIRARA_VERSION_MINOR = 2
GIRARA_VERSION_REV = 7 GIRARA_VERSION_REV = 8
VERSION = ${GIRARA_VERSION_MAJOR}.${GIRARA_VERSION_MINOR}.${GIRARA_VERSION_REV} VERSION = ${GIRARA_VERSION_MAJOR}.${GIRARA_VERSION_MINOR}.${GIRARA_VERSION_REV}
# Rules for the SOMAJOR and SOMINOR. # Rules for the SOMAJOR and SOMINOR.
# Before a release check perform the following checks against the last release: # Before a release perform the following checks against the last release:
# * If a function has been removed or the paramaters of a function have changed # * If a function has been removed or the paramaters of a function have changed
# bump SOMAJOR and set SOMINOR to 0. # bump SOMAJOR and set SOMINOR to 0.
# * If any of the exported datastructures have changed in a incompatible way # * If any of the exported datastructures have changed in a incompatible way
# bump SOMAJOR and set SOMINOR to 0. # bump SOMAJOR and set SOMINOR to 0.
# * If a function has been added bump SOMINOR. # * If a function has been added bump SOMINOR.
SOMAJOR = 2 SOMAJOR = 3
SOMINOR = 0 SOMINOR = 0
SOVERSION = ${SOMAJOR}.${SOMINOR} SOVERSION = ${SOMAJOR}.${SOMINOR}
# pkg-config binary # pkg-config binary
PKG_CONFIG ?= pkg-config PKG_CONFIG ?= pkg-config
# glib-compile-resource binary
GLIB_COMPILE_RESOURCES ?= glib-compile-resources
# libnotify # libnotify
WITH_LIBNOTIFY ?= $(shell (${PKG_CONFIG} libnotify --atleast-version=0.7.0 && echo 1) || echo 0) WITH_LIBNOTIFY ?= $(shell (${PKG_CONFIG} libnotify --atleast-version=0.7.0 && echo 1) || echo 0)
...@@ -46,29 +49,44 @@ BINDIR ?= bin ...@@ -46,29 +49,44 @@ BINDIR ?= bin
# GTK+ # GTK+
GTK_VERSION_CHECK ?= 1 GTK_VERSION_CHECK ?= 1
GTK_MIN_VERSION = 3.4 GTK_MIN_VERSION = 3.20
GTK_PKG_CONFIG_NAME = gtk+-3.0 GTK_PKG_CONFIG_NAME = gtk+-3.0
# glib # glib
GLIB_VERSION_CHECK ?= 1 GLIB_VERSION_CHECK ?= 1
GLIB_MIN_VERSION = 2.36 GLIB_MIN_VERSION = 2.50
GLIB_PKG_CONFIG_NAME = glib-2.0 GLIB_PKG_CONFIG_NAME = glib-2.0
# libs # libs
GTK_INC ?= $(shell ${PKG_CONFIG} --cflags gtk+-3.0) ifeq (${GTK_INC}-${GTK_LIB},-)
GTK_LIB ?= $(shell ${PKG_CONFIG} --libs gtk+-3.0) PKG_CONFIG_LIBS += gtk+-3.0
else
INCS += ${GTK_INC}
LIBS += ${GTK_LIB}
endif
ifneq (${WITH_LIBNOTIFY},0) ifneq (${WITH_LIBNOTIFY},0)
LIBNOTIFY_INC ?= $(shell ${PKG_CONFIG} --cflags libnotify) ifeq (${LIBNOTIFY_INC}-${LIBNOTIFY_LIB},-)
LIBNOTIFY_LIB ?= $(shell ${PKG_CONFIG} --libs libnotify) PKG_CONFIG_LIBS += libnotify
else
INCS += ${LIBNOTIFY_INC}
LIBS += ${LIBNOTIFY_LIB}
endif
endif endif
ifneq (${WITH_JSON},0) ifneq (${WITH_JSON},0)
JSON_INC ?= $(shell ${PKG_CONFIG} --cflags json-c) ifeq (${JSON_INC}-${JSON_LIB},-)
JSON_LIB ?= $(shell ${PKG_CONFIG} --libs json-c) PKG_CONFIG_LIBS += json-c
else
INCS += ${JSON_INC}
LIBS += ${JSON_LIB}
endif
endif endif
INCS = ${GTK_INC} ${LIBNOTIFY_INC} ${JSON_INC} ifneq (${PKG_CONFIG_LIBS},)
LIBS = ${GTK_LIB} ${LIBNOTIFY_LIB} ${JSON_LIB} -lm INCS += $(shell ${PKG_CONFIG} --cflags ${PKG_CONFIG_LIBS})
LIBS += $(shell ${PKG_CONFIG} --libs ${PKG_CONFIG_LIBS})
endif
LIBS += -lm
# pre-processor flags # pre-processor flags
CPPFLAGS += -D_FILE_OFFSET_BITS=64 CPPFLAGS += -D_FILE_OFFSET_BITS=64
......
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/pwmt/girara/CSS">
<file compressed="true">girara.css_t</file>
</gresource>
</gresources>
/* No resize grip */
#@session@ {
-GtkWindow-resize-grip-height: 0;
-GtkWindow-resize-grip-width: 0;
}
/* Hide scrollbars from GtkScrolledWindow */
#@session@ GtkScrolledWindow GtkScrollbar:insensitive {
-GtkRange-slider-width: 0;
-GtkRange-trough-border: 0;
}
#@session@ GtkScrolledWindow GtkScrollbar {
background-color: @scrollbar-bg@;
}
#@session@ GtkScrolledWindow GtkScrollbar.slider {
background-color: @scrollbar-fg@;
}
#@session@ * {
color: @default-fg@;
background-color: @default-bg@;
background-image: none;
font: @font@;
}
/* Inputbar */
#@session@ GtkEntry.inputbar {
background-color: @inputbar-bg@;
}
#@session@ .inputbar {
color: @inputbar-fg@;
background-color: @inputbar-bg@;
}
/* Completion entries and groups */
#@session@ .completion, .completion-box {
color: @completion-fg@;
background-color: @completion-bg@;
}
#@session@ .completion {
padding: 1px;
}
#@session@ .completion:selected {
color: @completion-highlight-fg@;
background-color: @completion-highlight-bg@;
}
#@session@ .completion-group {
color: @completion-group-fg@;
background-color: @completion-group-bg@;
padding: 2px 4px;
}
/* Statusbar */
#@session@ .statusbar {
color: @statusbar-fg@;
background-color: @statusbar-bg@;
}
/* Tabbar */
#@session@ .tab {
color: @tabbar-fg@;
background-color: @tabbar-bg@;
}
#@session@ GtkLabel.tab {
padding: 4px;
}
#@session@ .tab:selected {
color: @tabbar-focus-fg@;
background-color: @tabbar-focus-bg@;
}
/* Notification area */
#@session@ .notification {
color: @notification-fg@;
background-color: @notification-bg@;
}
#@session@ .notification-error {
color: @notification-error-fg@;
background-color: @notification-error-bg@;
}
#@session@ .notification-warning {
color: @notification-warning-fg@;
background-color: @notification-warning-bg@;
}
/* Padding of the bottom box */
#@session@ .bottom_box {
border-style: none;
margin: 0px;
padding: @bottombox-padding1@px @bottombox-padding2@px @bottombox-padding3@px
@bottombox-padding4@px;
}
#@session@ GtkScrolledWindow .undershoot.top,
#@session@ GtkScrolledWindow .undershoot.top:backdrop,
#@session@ GtkScrolledWindow .undershoot.bottom,
#@session@ GtkScrolledWindow .undershoot.bottom:backdrop,
#@session@ GtkScrolledWindow .undershoot.left,
#@session@ GtkScrolledWindow .undershoot.left:backdrop,
#@session@ GtkScrolledWindow .undershoot.right,
#@session@ GtkScrolledWindow .undershoot.right:backdrop {
background-color: transparent;
}
#@session@ * { #@session@ {
color: @default-fg@; color: @default-fg@;
background-color: @default-bg@; background-color: @default-bg@;
background-image: none; background-image: none;
...@@ -58,22 +58,6 @@ ...@@ -58,22 +58,6 @@
background-color: @statusbar-bg@; background-color: @statusbar-bg@;
} }
/* Tabbar */
#@session@ .tab {
color: @tabbar-fg@;
background-color: @tabbar-bg@;
}
#@session@ label.tab {
padding: 4px;
}
#@session@ .tab:selected {
color: @tabbar-focus-fg@;
background-color: @tabbar-focus-bg@;
}
/* Notification area */ /* Notification area */
#@session@ .notification { #@session@ .notification {
...@@ -115,6 +99,5 @@ ...@@ -115,6 +99,5 @@
#@session@ scrolledwindow overshoot.left:backdrop, #@session@ scrolledwindow overshoot.left:backdrop,
#@session@ scrolledwindow overshoot.right, #@session@ scrolledwindow overshoot.right,
#@session@ scrolledwindow overshoot.right:backdrop { #@session@ scrolledwindow overshoot.right:backdrop {
background-color: transparent;
background-image: none; background-image: none;
} }
/* See LICENSE file for license and copyright information */ /* See LICENSE file for license and copyright information */
#include "callbacks.h" #include "callbacks.h"
#include "datastructures.h" #include "datastructures.h"
#include "session.h"
#include "shortcuts.h"
#include "input-history.h" #include "input-history.h"
#include "internal.h" #include "internal.h"
#include "session.h"
#include "shortcuts.h"
#include "utils.h" #include "utils.h"
#include <string.h>
#include <glib/gi18n-lib.h> #include <glib/gi18n-lib.h>
#include <string.h>
static const guint ALL_ACCELS_MASK = GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK; static const guint ALL_ACCELS_MASK = GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK;
static const guint MOUSE_MASK = GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK | static const guint MOUSE_MASK = GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK |
...@@ -86,9 +87,11 @@ girara_callback_view_key_press_event(GtkWidget* UNUSED(widget), ...@@ -86,9 +87,11 @@ girara_callback_view_key_press_event(GtkWidget* UNUSED(widget),
return false; return false;
} }
girara_session_private_t* session_private = session->private_data;
/* prepare event */ /* prepare event */
GIRARA_LIST_FOREACH(session->bindings.shortcuts, girara_shortcut_t*, iter, shortcut) GIRARA_LIST_FOREACH(session->bindings.shortcuts, girara_shortcut_t*, iter, shortcut)
if (session->buffer.command != NULL) { if (session_private->buffer.command != NULL) {
break; break;
} }
...@@ -99,9 +102,9 @@ girara_callback_view_key_press_event(GtkWidget* UNUSED(widget), ...@@ -99,9 +102,9 @@ girara_callback_view_key_press_event(GtkWidget* UNUSED(widget),
&& shortcut->function != NULL && shortcut->function != NULL
) )
{ {
int t = (session->buffer.n > 0) ? session->buffer.n : 1; const int t = (session_private->buffer.n > 0) ? session_private->buffer.n : 1;
for (int i = 0; i < t; i++) { for (int i = 0; i < t; i++) {
if (shortcut->function(session, &(shortcut->argument), NULL, session->buffer.n) == false) { if (shortcut->function(session, &(shortcut->argument), NULL, session_private->buffer.n) == false) {
break; break;
} }
} }
...@@ -111,7 +114,7 @@ girara_callback_view_key_press_event(GtkWidget* UNUSED(widget), ...@@ -111,7 +114,7 @@ girara_callback_view_key_press_event(GtkWidget* UNUSED(widget),
session->global.buffer = NULL; session->global.buffer = NULL;
} }
session->buffer.n = 0; session_private->buffer.n = 0;
if (session->events.buffer_changed != NULL) { if (session->events.buffer_changed != NULL) {
session->events.buffer_changed(session); session->events.buffer_changed(session);
...@@ -131,16 +134,16 @@ girara_callback_view_key_press_event(GtkWidget* UNUSED(widget), ...@@ -131,16 +134,16 @@ girara_callback_view_key_press_event(GtkWidget* UNUSED(widget),
session->global.buffer = g_string_append_c(session->global.buffer, keyval); session->global.buffer = g_string_append_c(session->global.buffer, keyval);
if (session->buffer.command == NULL && keyval >= 0x30 && keyval <= 0x39) { if (session_private->buffer.command == NULL && keyval >= 0x30 && keyval <= 0x39) {
if (((session->buffer.n * 10) + (keyval - '0')) < INT_MAX) { if (((session_private->buffer.n * 10) + (keyval - '0')) < INT_MAX) {
session->buffer.n = (session->buffer.n * 10) + (keyval - '0'); session_private->buffer.n = (session_private->buffer.n * 10) + (keyval - '0');
} }
} else { } else {
if (session->buffer.command == NULL) { if (session_private->buffer.command == NULL) {
session->buffer.command = g_string_new(""); session_private->buffer.command = g_string_new("");
} }
session->buffer.command = g_string_append_c(session->buffer.command, keyval); session_private->buffer.command = g_string_append_c(session_private->buffer.command, keyval);
} }
if (session->events.buffer_changed != NULL) { if (session->events.buffer_changed != NULL) {
...@@ -149,33 +152,33 @@ girara_callback_view_key_press_event(GtkWidget* UNUSED(widget), ...@@ -149,33 +152,33 @@ girara_callback_view_key_press_event(GtkWidget* UNUSED(widget),
} }
/* check for buffer command */ /* check for buffer command */
if (session->buffer.command != NULL) { if (session_private->buffer.command != NULL) {
bool matching_command = FALSE; bool matching_command = FALSE;
GIRARA_LIST_FOREACH(session->bindings.shortcuts, girara_shortcut_t*, iter, shortcut) GIRARA_LIST_FOREACH(session->bindings.shortcuts, girara_shortcut_t*, iter, shortcut)
if (shortcut->buffered_command != NULL) { if (shortcut->buffered_command != NULL) {
/* buffer could match a command */ /* buffer could match a command */
if (!strncmp(session->buffer.command->str, shortcut->buffered_command, session->buffer.command->len)) { if (!strncmp(session_private->buffer.command->str, shortcut->buffered_command, session_private->buffer.command->len)) {
/* command matches buffer exactly */ /* command matches buffer exactly */
if (!strcmp(session->buffer.command->str, shortcut->buffered_command) if (!strcmp(session_private->buffer.command->str, shortcut->buffered_command)
&& (session->modes.current_mode == shortcut->mode || shortcut->mode == 0)) { && (session->modes.current_mode == shortcut->mode || shortcut->mode == 0)) {
g_string_free(session->buffer.command, TRUE); g_string_free(session_private->buffer.command, TRUE);
g_string_free(session->global.buffer, TRUE); g_string_free(session->global.buffer, TRUE);
session->buffer.command = NULL; session_private->buffer.command = NULL;
session->global.buffer = NULL; session->global.buffer = NULL;
if (session->events.buffer_changed != NULL) { if (session->events.buffer_changed != NULL) {
session->events.buffer_changed(session); session->events.buffer_changed(session);
} }
int t = (session->buffer.n > 0) ? session->buffer.n : 1; int t = (session_private->buffer.n > 0) ? session_private->buffer.n : 1;
for (int i = 0; i < t; i++) { for (int i = 0; i < t; i++) {
if (shortcut->function(session, &(shortcut->argument), NULL, session->buffer.n) == false) { if (shortcut->function(session, &(shortcut->argument), NULL, session_private->buffer.n) == false) {
break; break;
} }
} }
session->buffer.n = 0; session_private->buffer.n = 0;
girara_list_iterator_free(iter); girara_list_iterator_free(iter);
return TRUE; return TRUE;
} }
...@@ -187,11 +190,11 @@ girara_callback_view_key_press_event(GtkWidget* UNUSED(widget), ...@@ -187,11 +190,11 @@ girara_callback_view_key_press_event(GtkWidget* UNUSED(widget),
/* free buffer if buffer will never match a command */ /* free buffer if buffer will never match a command */
if (matching_command == false) { if (matching_command == false) {
g_string_free(session->buffer.command, TRUE); g_string_free(session_private->buffer.command, TRUE);
g_string_free(session->global.buffer, TRUE); g_string_free(session->global.buffer, TRUE);
session->buffer.command = NULL; session_private->buffer.command = NULL;
session->global.buffer = NULL; session->global.buffer = NULL;
session->buffer.n = 0; session_private->buffer.n = 0;
if (session->events.buffer_changed != NULL) { if (session->events.buffer_changed != NULL) {
session->events.buffer_changed(session); session->events.buffer_changed(session);
...@@ -210,7 +213,10 @@ girara_callback_view_button_press_event(GtkWidget* UNUSED(widget), ...@@ -210,7 +213,10 @@ girara_callback_view_button_press_event(GtkWidget* UNUSED(widget),
g_return_val_if_fail(button != NULL, false); g_return_val_if_fail(button != NULL, false);
/* prepare girara event */ /* prepare girara event */
girara_event_t event; girara_event_t event = {
.x = button->x,
.y = button->y
};
switch (button->type) { switch (button->type) {
case GDK_BUTTON_PRESS: case GDK_BUTTON_PRESS:
...@@ -227,10 +233,8 @@ girara_callback_view_button_press_event(GtkWidget* UNUSED(widget), ...@@ -227,10 +233,8 @@ girara_callback_view_button_press_event(GtkWidget* UNUSED(widget),
break; break;
} }
event.x = button->x;
event.y = button->y;
const guint state = button->state & MOUSE_MASK; const guint state = button->state & MOUSE_MASK;
girara_session_private_t* session_private = session->private_data;
/* search registered mouse events */ /* search registered mouse events */
GIRARA_LIST_FOREACH(session->bindings.mouse_events, girara_mouse_event_t*, iter, mouse_event) GIRARA_LIST_FOREACH(session->bindings.mouse_events, girara_mouse_event_t*, iter, mouse_event)
...@@ -240,7 +244,7 @@ girara_callback_view_button_press_event(GtkWidget* UNUSED(widget), ...@@ -240,7 +244,7 @@ girara_callback_view_button_press_event(GtkWidget* UNUSED(widget),
&& mouse_event->event_type == event.type && mouse_event->event_type == event.type
&& (session->modes.current_mode == mouse_event->mode || mouse_event->mode == 0) && (session->modes.current_mode == mouse_event->mode || mouse_event->mode == 0)
) { ) {
mouse_event->function(session, &(mouse_event->argument), &event, session->buffer.n); mouse_event->function(session, &(mouse_event->argument), &event, session_private->buffer.n);
girara_list_iterator_free(iter); girara_list_iterator_free(iter);
return true; return true;
} }
...@@ -256,12 +260,14 @@ girara_callback_view_button_release_event(GtkWidget* UNUSED(widget), GdkEventBut ...@@ -256,12 +260,14 @@ girara_callback_view_button_release_event(GtkWidget* UNUSED(widget), GdkEventBut
g_return_val_if_fail(button != NULL, false); g_return_val_if_fail(button != NULL, false);
/* prepare girara event */ /* prepare girara event */
girara_event_t event; girara_event_t event = {
event.type = GIRARA_EVENT_BUTTON_RELEASE; .type = GIRARA_EVENT_BUTTON_RELEASE,
event.x = button->x; .x = button->x,
event.y = button->y; .y = button->y
};
const guint state = button->state & MOUSE_MASK; const guint state = button->state & MOUSE_MASK;
girara_session_private_t* session_private = session->private_data;
/* search registered mouse events */ /* search registered mouse events */
GIRARA_LIST_FOREACH(session->bindings.mouse_events, girara_mouse_event_t*, iter, mouse_event) GIRARA_LIST_FOREACH(session->bindings.mouse_events, girara_mouse_event_t*, iter, mouse_event)
...@@ -271,7 +277,7 @@ girara_callback_view_button_release_event(GtkWidget* UNUSED(widget), GdkEventBut ...@@ -271,7 +277,7 @@ girara_callback_view_button_release_event(GtkWidget* UNUSED(widget), GdkEventBut
&& mouse_event->event_type == GIRARA_EVENT_BUTTON_RELEASE && mouse_event->event_type == GIRARA_EVENT_BUTTON_RELEASE
&& (session->modes.current_mode == mouse_event->mode || mouse_event->mode == 0) && (session->modes.current_mode == mouse_event->mode || mouse_event->mode == 0)
) { ) {
mouse_event->function(session, &(mouse_event->argument), &event, session->buffer.n); mouse_event->function(session, &(mouse_event->argument), &event, session_private->buffer.n);
girara_list_iterator_free(iter); girara_list_iterator_free(iter);
return true; return true;
} }
...@@ -294,6 +300,7 @@ girara_callback_view_button_motion_notify_event(GtkWidget* UNUSED(widget), GdkEv ...@@ -294,6 +300,7 @@ girara_callback_view_button_motion_notify_event(GtkWidget* UNUSED(widget), GdkEv
}; };
const guint state = button->state & MOUSE_MASK; const guint state = button->state & MOUSE_MASK;
girara_session_private_t* session_private = session->private_data;
/* search registered mouse events */ /* search registered mouse events */
GIRARA_LIST_FOREACH(session->bindings.mouse_events, girara_mouse_event_t*, iter, mouse_event) GIRARA_LIST_FOREACH(session->bindings.mouse_events, girara_mouse_event_t*, iter, mouse_event)
...@@ -302,7 +309,7 @@ girara_callback_view_button_motion_notify_event(GtkWidget* UNUSED(widget), GdkEv ...@@ -302,7 +309,7 @@ girara_callback_view_button_motion_notify_event(GtkWidget* UNUSED(widget), GdkEv
&& mouse_event->event_type == event.type && mouse_event->event_type == event.type
&& (session->modes.current_mode == mouse_event->mode || mouse_event->mode == 0) && (session->modes.current_mode == mouse_event->mode || mouse_event->mode == 0)
) { ) {
mouse_event->function(session, &(mouse_event->argument), &event, session->buffer.n); mouse_event->function(session, &(mouse_event->argument), &event, session_private->buffer.n);
girara_list_iterator_free(iter); girara_list_iterator_free(iter);
return true; return true;
} }
...@@ -318,9 +325,10 @@ girara_callback_view_scroll_event(GtkWidget* UNUSED(widget), GdkEventScroll* scr ...@@ -318,9 +325,10 @@ girara_callback_view_scroll_event(GtkWidget* UNUSED(widget), GdkEventScroll* scr
g_return_val_if_fail(scroll != NULL, false); g_return_val_if_fail(scroll != NULL, false);
/* prepare girara event */ /* prepare girara event */
girara_event_t event; girara_event_t event = {
event.x = scroll->x; .x = scroll->x,
event.y = scroll->y; .y = scroll->y
};
switch (scroll->direction) { switch (scroll->direction) {
case GDK_SCROLL_UP: case GDK_SCROLL_UP:
...@@ -345,6 +353,7 @@ girara_callback_view_scroll_event(GtkWidget* UNUSED(widget), GdkEventScroll* scr ...@@ -345,6 +353,7 @@ girara_callback_view_scroll_event(GtkWidget* UNUSED(widget), GdkEventScroll* scr
} }
const guint state = scroll->state & MOUSE_MASK; const guint state = scroll->state & MOUSE_MASK;
girara_session_private_t* session_private = session->private_data;
/* search registered mouse events */ /* search registered mouse events */
/* TODO: Filter correct event */ /* TODO: Filter correct event */
...@@ -354,7 +363,7 @@ girara_callback_view_scroll_event(GtkWidget* UNUSED(widget), GdkEventScroll* scr ...@@ -354,7 +363,7 @@ girara_callback_view_scroll_event(GtkWidget* UNUSED(widget), GdkEventScroll* scr
&& mouse_event->event_type == event.type && mouse_event->event_type == event.type