mirror of
https://github.com/wizbright/waybox.git
synced 2025-10-29 05:40:20 -04:00
Merge branch 'basic-functionality'
This commit is contained in:
commit
9ebbc7624c
3 changed files with 13 additions and 19 deletions
|
|
@ -2,13 +2,13 @@
|
|||
#include "waybox/cursor.h"
|
||||
#include "waybox/xdg_shell.h"
|
||||
|
||||
static void process_cursor_move(struct wb_server *server, uint32_t time) {
|
||||
static void process_cursor_move(struct wb_server *server) {
|
||||
/* Move the grabbed view to the new position. */
|
||||
server->grabbed_view->x = server->cursor->cursor->x - server->grab_x;
|
||||
server->grabbed_view->y = server->cursor->cursor->y - server->grab_y;
|
||||
}
|
||||
|
||||
static void process_cursor_resize(struct wb_server *server, uint32_t time) {
|
||||
static void process_cursor_resize(struct wb_server *server) {
|
||||
struct wb_view *view = server->grabbed_view;
|
||||
double dx = server->cursor->cursor->x - server->grab_x;
|
||||
double dy = server->cursor->cursor->y - server->grab_y;
|
||||
|
|
@ -42,10 +42,10 @@ static void process_cursor_resize(struct wb_server *server, uint32_t time) {
|
|||
static void process_cursor_motion(struct wb_server *server, uint32_t time) {
|
||||
/* If the mode is non-passthrough, delegate to those functions. */
|
||||
if (server->cursor->cursor_mode == WB_CURSOR_MOVE) {
|
||||
process_cursor_move(server, time);
|
||||
process_cursor_move(server);
|
||||
return;
|
||||
} else if (server->cursor->cursor_mode == WB_CURSOR_RESIZE) {
|
||||
process_cursor_resize(server, time);
|
||||
process_cursor_resize(server);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,23 +5,19 @@
|
|||
|
||||
#include "waybox/server.h"
|
||||
|
||||
int main(int argc, char **argv){
|
||||
int main(int argc, char **argv) {
|
||||
char *startup_cmd = NULL;
|
||||
if (argc > 0) {
|
||||
int i;
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
for (i = 0; i < argc; i++) {
|
||||
if (!strcmp("--debug", argv[i]) || !strcmp("-v", argv[i]) || !strcmp("--exit", argv[i])) {
|
||||
printf("Warning: option %s is currently unimplemented\n", argv[i]);
|
||||
}
|
||||
else if ((!strcmp("--startup", argv[i]) || !strcmp("-s", argv[i])) && i < argc) {
|
||||
} else if ((!strcmp("--startup", argv[i]) || !strcmp("-s", argv[i])) && i < argc) {
|
||||
startup_cmd = argv[i + 1];
|
||||
}
|
||||
else if (!strcmp("--version", argv[i]) || !strcmp("-V", argv[i])) {
|
||||
} else if (!strcmp("--version", argv[i]) || !strcmp("-V", argv[i])) {
|
||||
printf(VERSION "\n");
|
||||
return 0;
|
||||
}
|
||||
else if (argv[i][0] == '-') {
|
||||
} else if (argv[i][0] == '-') {
|
||||
printf("Usage: %s [--debug] [--exit] [--help] [--startup CMD] [--version]\n", argv[0]);
|
||||
return strcmp("--help", argv[i]) != 0 && strcmp("-h", argv[i]) != 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,8 +12,7 @@ static bool handle_keybinding(struct wb_server *server, xkb_keysym_t sym, uint32
|
|||
|
||||
if (modifiers & WLR_MODIFIER_CTRL && sym == XKB_KEY_Escape) {
|
||||
wl_display_terminate(server->wl_display);
|
||||
}
|
||||
else if (modifiers & WLR_MODIFIER_ALT && sym == XKB_KEY_Tab) {
|
||||
} else if (modifiers & WLR_MODIFIER_ALT && sym == XKB_KEY_Tab) {
|
||||
/* Cycle to the next view */
|
||||
if (wl_list_length(&server->views) < 2) {
|
||||
return false;
|
||||
|
|
@ -26,14 +25,13 @@ static bool handle_keybinding(struct wb_server *server, xkb_keysym_t sym, uint32
|
|||
/* Move the previous view to the end of the list */
|
||||
wl_list_remove(¤t_view->link);
|
||||
wl_list_insert(server->views.prev, ¤t_view->link);
|
||||
}
|
||||
else if (modifiers & WLR_MODIFIER_ALT && sym == XKB_KEY_F2)
|
||||
{
|
||||
} else if (modifiers & WLR_MODIFIER_ALT && sym == XKB_KEY_F2) {
|
||||
if (fork() == 0) {
|
||||
execl("/bin/sh", "/bin/sh", "-c", "(obrun || bemenu-run || synapse || gmrun || gnome-do || dmenu_run) 2>/dev/null", NULL);
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
else return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue