Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'vanilla/next' into gaps-next
Browse files Browse the repository at this point in the history
  • Loading branch information
Airblader committed Apr 10, 2020
2 parents eb15cdc + e2b2a28 commit d17da4d
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 151 deletions.
13 changes: 13 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -629,3 +629,16 @@ CLEANFILES = \
i3-command-parser.stamp \
i3-config-parser.stamp \
anyevent-i3.stamp

################################################################################
# Language Server support
################################################################################

# Recursively run make through https://github.com/rizsotto/Bear,
# which generates a compile_commands.json file in the source directory.
# This is useful for running e.g. the clangd or ccls language servers:
# https://clang.llvm.org/extra/clangd/
# https://github.com/MaskRay/ccls/wiki
.PHONY: bear
bear: clean
bear -o $(top_srcdir)/compile_commands.json $(MAKE) $(MAKEFLAGS)
28 changes: 28 additions & 0 deletions i3bar/src/child.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

/* Global variables for child_*() */
i3bar_child child;
#define DLOG_CHILD DLOG("%s: pid=%ld stopped=%d stop_signal=%d cont_signal=%d click_events=%d click_events_init=%d\n", \
__func__, (long)child.pid, child.stopped, child.stop_signal, child.cont_signal, child.click_events, child.click_events_init)

/* stdin- and SIGCHLD-watchers */
ev_io *stdin_io;
Expand Down Expand Up @@ -194,6 +196,11 @@ static int stdin_map_key(void *context, const unsigned char *key, size_t len) {

static int stdin_boolean(void *context, int val) {
parser_ctx *ctx = context;

if (!ctx->last_map_key) {
return 0;
}

if (strcasecmp(ctx->last_map_key, "urgent") == 0) {
ctx->block.urgent = val;
return 1;
Expand All @@ -208,6 +215,11 @@ static int stdin_boolean(void *context, int val) {

static int stdin_string(void *context, const unsigned char *val, size_t len) {
parser_ctx *ctx = context;

if (!ctx->last_map_key) {
return 0;
}

if (strcasecmp(ctx->last_map_key, "full_text") == 0) {
ctx->block.full_text = i3string_from_markup_with_length((const char *)val, len);
return 1;
Expand Down Expand Up @@ -260,6 +272,11 @@ static int stdin_string(void *context, const unsigned char *val, size_t len) {

static int stdin_integer(void *context, long long val) {
parser_ctx *ctx = context;

if (!ctx->last_map_key) {
return 0;
}

if (strcasecmp(ctx->last_map_key, "min_width") == 0) {
ctx->block.min_width = (uint32_t)val;
return 1;
Expand Down Expand Up @@ -604,9 +621,12 @@ void start_child(char *command) {
ev_child_start(main_loop, child_sig);

atexit(kill_child_at_exit);
DLOG_CHILD;
}

static void child_click_events_initialize(void) {
DLOG_CHILD;

if (!child.click_events_init) {
yajl_gen_array_open(gen);
child_write_output();
Expand Down Expand Up @@ -685,6 +705,8 @@ void send_block_clicked(int button, const char *name, const char *instance, int
*
*/
void kill_child_at_exit(void) {
DLOG_CHILD;

if (child.pid > 0) {
if (child.cont_signal > 0 && child.stopped)
killpg(child.pid, child.cont_signal);
Expand All @@ -698,6 +720,8 @@ void kill_child_at_exit(void) {
*
*/
void kill_child(void) {
DLOG_CHILD;

if (child.pid > 0) {
if (child.cont_signal > 0 && child.stopped)
killpg(child.pid, child.cont_signal);
Expand All @@ -713,6 +737,8 @@ void kill_child(void) {
*
*/
void stop_child(void) {
DLOG_CHILD;

if (child.stop_signal > 0 && !child.stopped) {
child.stopped = true;
killpg(child.pid, child.stop_signal);
Expand All @@ -724,6 +750,8 @@ void stop_child(void) {
*
*/
void cont_child(void) {
DLOG_CHILD;

if (child.cont_signal > 0 && child.stopped) {
child.stopped = false;
killpg(child.pid, child.cont_signal);
Expand Down
10 changes: 3 additions & 7 deletions src/click.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,18 +242,18 @@ static void route_click(Con *con, xcb_button_press_event_t *event, const bool mo

/* 5: resize (floating) if this was a (left or right) click on the
* left/right/bottom border, or a right click on the decoration.
* also try resizing (tiling) if it was a click on the top */
* also try resizing (tiling) if possible */
if (mod_pressed && event->detail == XCB_BUTTON_CLICK_RIGHT) {
DLOG("floating resize due to floatingmodifier\n");
floating_resize_window(floatingcon, proportional, event);
return;
}

if (!in_stacked && dest == CLICK_DECORATION &&
if ((dest == CLICK_BORDER || dest == CLICK_DECORATION) &&
is_left_or_right_click) {
/* try tiling resize, but continue if it doesn’t work */
DLOG("tiling resize with fallback\n");
if (tiling_resize(con, event, dest, !was_focused))
if (tiling_resize(con, event, dest, dest == CLICK_DECORATION && !was_focused))
goto done;
}

Expand Down Expand Up @@ -290,10 +290,6 @@ static void route_click(Con *con, xcb_button_press_event_t *event, const bool mo
else if ((dest == CLICK_BORDER || dest == CLICK_DECORATION) &&
is_left_or_right_click) {
DLOG("Trying to resize (tiling)\n");
/* Since we updated the tree (con_activate() above), we need to
* re-render the tree before returning to the event loop (drag_pointer()
* inside tiling_resize() runs its own event-loop). */
tree_render();
tiling_resize(con, event, dest, dest == CLICK_DECORATION && !was_focused);
}

Expand Down

0 comments on commit d17da4d

Please sign in to comment.