Skip to content

Commit

Permalink
meta-tab window switching and make log messages optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Unesty committed Nov 24, 2020
1 parent 01ca06d commit 4023426
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/swvkc.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,10 +595,34 @@ void input_key_notify(struct aaa *e, void *user_data) {
wl_display_terminate(server->display);
break;
}
struct surface_node *match;
if( e->key == KEY_TAB) {
struct wl_list *current_surface;
current_surface = server->mapped_surfaces_list.next;
for(uint8_t c=0; c<i+1;c++){
if(current_surface->next==&server->mapped_surfaces_list){ //we are in the start of the list
current_surface = current_surface->next->next->next;//to start going back
//current_surface = current_surface->prev->next;// prev->next is going to the begining of the list
} else if(current_surface!=NULL) {
current_surface = current_surface->next;
} else {
break;
}
}
if(server->mapped_surfaces_list.next->prev!=server->mapped_surfaces_list.next->next) {
if(current_surface!=&server->mapped_surfaces_list){
match = wl_container_of(current_surface, match, link);
errlog("match %p", (void*)match);
server_change_focus(server, match);
}
}
i++;
break;
}
errlog("the key '%s' was pressed", e->name);
name[i] = e->name[0];
i++;
struct surface_node *match = match_app_id(server, name);
match = match_app_id(server, name);
errlog("match %p", (void*)match);
if (match)
server_change_focus(server, match);
Expand Down
4 changes: 4 additions & 0 deletions subprojects/libswvkc-wl/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ add_project_arguments('-pedantic-errors', '-Wno-unused-parameter',
'-Wno-unused-function', language: 'c')
add_project_link_arguments('-lm', language: 'c')

if get_option('buildtype').startswith('debug')
add_project_arguments('-DDEBUG',language: 'c')
endif

c = 'core/'
u = 'util/'
x = 'extensions/'
Expand Down
5 changes: 5 additions & 0 deletions subprojects/libswvkc-wl/util/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <stdio.h>
#include <time.h>

#if defined DEBUG
void errlog(const char *fmt, ...) {
va_list args;
va_start(args, fmt);
Expand All @@ -27,3 +28,7 @@ void boxlog(const char *fmt, ...) {
fprintf(stdout, "\n");
va_end(args);
}
#else
void errlog(const char *fmt, ...) {}
void boxlog(const char *fmt, ...) {}
#endif

0 comments on commit 4023426

Please sign in to comment.