From d9d18bf7f3817c7fcb6854cdf0f8c89e89617fe9 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Tue, 12 Mar 2024 15:10:20 -0300 Subject: [PATCH] gtk3 to gtk4: don't access GdkEvent fields directly --- config.h | 1 + makefile | 10 +++++----- rose | Bin 39008 -> 39112 bytes rose.c | 12 +++++++++--- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/config.h b/config.h index 7fff23a..7513012 100644 --- a/config.h +++ b/config.h @@ -75,6 +75,7 @@ typedef enum { #define SFT 1 << 0 #define CTRL 1 << 2 #define ALT 1 << 3 +// reference: static struct { unsigned mod; diff --git a/makefile b/makefile index 1ee729d..286231d 100644 --- a/makefile +++ b/makefile @@ -1,8 +1,8 @@ - # C compiler CC=gcc # other options: tcc, clang, zig cc WARNINGS=-Wall DEBUG= #'-g' +COMPILETIME_DEPRECATION_WARNINGS=#-DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED # turns out that webkit2gtk-4.1 is using some deprecated stuff, lol OPTIMIZED_SOME=-O3 OPTIMIZED_MORE=-Ofast -march=native -funit-at-a-time -flto # binary will not be compatible with other computers, but may be much faster @@ -29,12 +29,12 @@ STYLE_BLUEPRINT=webkit FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT) # Change hardcoded paths when building -## Cache +## Data dirs USER=`whoami` DEFAULT_DATA_DIR=/home/nuno/.cache/rose CURRENT_DATA_DIR=/home/$(USER)/.cache/rose ## dir -DEFAULT_DIR=/home/loki/Documents/core/software/fresh/C/rose-browser/rosenrot +DEFAULT_DIR=/home/nuno/Documents/workspace/rosenrot CURRENT_DIR=`pwd` build: $(SRC) $(PLUGINS) $(CONFIG) @@ -51,7 +51,7 @@ build: $(SRC) $(PLUGINS) $(CONFIG) sed -i "s|$(DEFAULT_DIR)|$(CURRENT_DIR)|g" {} + # Compile rosenrot GIO_MODULE_DIR=/usr/lib/x86_64-linux-gnu/gio/modules/ - $(CC) $(WARNINGS) $(OPTIMIZED_SOME) $(DEBUG) $(INCS) $(PLUGINS) $(SRC) -o rose $(LIBS) $(ADBLOCK) + $(CC) $(WARNINGS) $(OPTIMIZED_SOME) $(DEBUG) $(INCS) $(PLUGINS) $(SRC) $(COMPILETIME_DEPRECATION_WARNINGS) -o rose $(LIBS) $(ADBLOCK) fast: $(SRC) $(PLUGINS) $(CONFIG) rm -f *.gcda @@ -92,7 +92,7 @@ format: $(SRC) $(PLUGINS) $(FORMATTER) $(SRC) $(PLUGINS) $(rose.h) diagnose_deprecations: - make && G_ENABLE_DIAGNOSTIC=1 ./rose + G_ENABLE_DIAGNOSTIC=1 ./rose view-gtk3-version: dpkg -l libgtk-3-0 diff --git a/rose b/rose index d6a6f8d67efc4a314f7b7fc34b9906ef7af6482e..8a5127502be3aa541eb5267b261ef462ee8d49d0 100755 GIT binary patch delta 6490 zcmZu$30PD|w!Q_l=|-R%#OZE>(z1x_0HY0JL}&$UHo>Tg`P^{gf`~>#?$EcW?cs0JD8J%&>oxje#Juys*ugme*0XH|E~?P_)3qz-|r(@6+BSPqnCq|Gv{GQ1!^VgBGjd* zRjAddD^ORWK7qO#bq#6_sw`_!*HL81M$tvvLhND}eGKZNk5@Qkf0M}}?x$w6ol;CG zo6I2;Vu}_)jJ!$0WEXC!6c1A~+UIFD=pxz++DA(03Wk@mZa($zVHcNK_h*`j_8%Di z5=&lYE5B#o9g5 z!WlQ0XK{=@Kf`{4*=ID%2O9J$)-r+Rqe-^E=k`pgHBA+YqFW4QbUE9qrL~r1@e0qV zo+XdMx`XFn3r!J8thvs1;@IzYmfT^9kG<^Xc0A9smbEYQs=8Qyheu^%&9{aBqTd4{~KP!~LB$gdgl z?D4u_jv*gn$X(+ML6FWL)#ZZ~SFSD?Vdy`xD2h$#qqyn}fx*sEbA;U)WteO7=;CMb zIAz&Ddn4?^D#J1R4Pb1FQ!#h5VCiWrb(B6P+L+3344b9Jy8MJ8-(|>`jMn9MjnIsu ziB@~fM?6pGf6dcjc)4N(=n-RvK9laf%vkSj-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S{9wE?jkO!F9L#S9T_~;V%Qz;(GG9%M*~-Q2kt>%l+5x5AbJzb9p&XuE*h) z6U7Ok)HI^>!2C{2VI!8J7G(v>e3XM&+D4QzluVS5WWl++3f=^62j&vE1|A1l7)l%J zO(=NtjcCbS6eeoAJ~WJYoS`1@aTdIkery;gG3FldY{(-{8Ai3_rw!wM@NwXm!CS$H z;w5|B8N-+je&noSY?u5q!{`7HIFCpqzhD?qc#G%)cY&958b$^9Zt&gyT8wrC3)}-i zK$l@G#oN|)@V($YSg0=WlXUH=5%~Udl#LY{6_v$`eYCR7CSE0XSt`D;+smejObTBd z4Vtt#Rn&uywNxO)kEj{#I6A#}tY6O=>RUb>ANtAVqy0M1(!%mlxa>XUqs6E6MtOqY z&2#is`Bc$CX-lf$bpMhJzs?JEeMyQ4q>)R52wWxCuFcyM!Tg|uVo=U5`= zV((kJ_pKZO@H5$Ja&P-_pLUr~dyP-~d7t)6ba7cU?tig-o@k;4%cI3)+ORw$NmsA` z5vpJL5-uO?Sbpq-P41P)(Y56nF*>d<`QYfu{EFs{@~Ucg4Q%<@(|i0?3;Mddr zHLsqAnYp%lgjh?CifN7&xLoglW}@MTFY6}SP+{}yOrsYoa*@usSn)S3-y4+)7(jRB z6f9`c8k-2CthN1V_L_L>cZiNZ$Z6}E4C`4=LWl|pvD({@Q67qAQEH+5s30xH(Um>W!kII+;5>2OIM8Q7AtH{Z{~BE~FZx((EB z2QVD&z28J?8MI>zLAC{%qVFYjgkk?km%g9xPR?5tO6qt@VSFFbO>RWA`LgX;>D@^_d5sNhX(pfA*z&JHawST(+@f+0S!u#e@_DP)MjMDn%I=*3F8jmrGX$sQ< zrt_IrGyNsgS0qh(9Y%G+R=~{9vkey.state); + printf("Keypress state: %d\n", event_state); if(event->key.state & GDK_CONTROL_MASK){ printf("Keypress state is: CONTROL\n"); } - printf("Keypress value: %d\n", event->key.keyval); + printf("Keypress value: %d\n", event_keyval); */ + for (int i = 0; i < sizeof(shortcut) / sizeof(shortcut[0]); i++) - if ((event->key.state & shortcut[i].mod || shortcut[i].mod == 0x0) && event->key.keyval == shortcut[i].key) + if ((event_state & shortcut[i].mod || shortcut[i].mod == 0x0) && event_keyval == shortcut[i].key) return handle_shortcut(shortcut[i].id, notebook); /* If I wanted to bind button presses, like the extra button in the mouse,