Skip to content

Commit 42ec7de

Browse files
committed
meta-tab window switching and make debug messages optional
1 parent 01ca06d commit 42ec7de

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

src/swvkc.c

+26-1
Original file line numberDiff line numberDiff line change
@@ -595,14 +595,39 @@ void input_key_notify(struct aaa *e, void *user_data) {
595595
wl_display_terminate(server->display);
596596
break;
597597
}
598+
struct surface_node *match;
599+
if( e->key == KEY_TAB) {
600+
struct wl_list *current_surface;
601+
current_surface = server->mapped_surfaces_list.next;
602+
for(uint8_t c=0; c<i+1;c++){
603+
if(current_surface!=NULL) {
604+
current_surface = current_surface->next;
605+
} else {
606+
break;
607+
}
608+
}
609+
if(server->mapped_surfaces_list.next->prev!=server->mapped_surfaces_list.next->next) {
610+
if(current_surface!=&server->mapped_surfaces_list){
611+
match = wl_container_of(current_surface, match, link);
612+
errlog("match %p", (void*)match);
613+
server_change_focus(server, match);
614+
}
615+
}
616+
i++;
617+
break;
618+
}
598619
errlog("the key '%s' was pressed", e->name);
599620
name[i] = e->name[0];
600621
i++;
601-
struct surface_node *match = match_app_id(server, name);
622+
match = match_app_id(server, name);
602623
errlog("match %p", (void*)match);
603624
if (match)
604625
server_change_focus(server, match);
605626
} else if (steal) {
627+
if (e->key == KEY_ESC) {
628+
wl_display_terminate(server->display);
629+
break;
630+
}
606631
} else if (!wl_list_empty(&server->mapped_surfaces_list)) {
607632
struct wl_resource *keyboard = focused_surface_keyboard(server);
608633
if (keyboard) {

subprojects/libswvkc-wl/meson.build

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ add_project_arguments('-pedantic-errors', '-Wno-unused-parameter',
44
'-Wno-unused-function', language: 'c')
55
add_project_link_arguments('-lm', language: 'c')
66

7+
if get_option('buildtype').startswith('debug')
8+
add_project_arguments('-DDEBUG',language: 'c')
9+
endif
10+
711
c = 'core/'
812
u = 'util/'
913
x = 'extensions/'

subprojects/libswvkc-wl/util/log.c

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <stdio.h>
44
#include <time.h>
55

6+
#if defined NDEBUG
67
void errlog(const char *fmt, ...) {
78
va_list args;
89
va_start(args, fmt);
@@ -27,3 +28,7 @@ void boxlog(const char *fmt, ...) {
2728
fprintf(stdout, "\n");
2829
va_end(args);
2930
}
31+
#else
32+
void errlog(const char *fmt, ...) {}
33+
void boxlog(const char *fmt, ...) {}
34+
#endif

0 commit comments

Comments
 (0)