Merge remote-tracking branch 'upstream/master' into set-size-command

This commit is contained in:
Zandr Martin 2016-07-02 08:14:40 -05:00
commit 034410819d
No known key found for this signature in database
GPG key ID: AA2BB8EF77F7BBDC
7 changed files with 23 additions and 14 deletions

View file

@ -12,9 +12,9 @@
#include <string.h> #include <string.h>
#include <stringop.h> #include <stringop.h>
int colored = 1; static int colored = 1;
log_importance_t loglevel_default = L_ERROR; static log_importance_t loglevel_default = L_ERROR;
log_importance_t v = L_SILENT; static log_importance_t v = L_SILENT;
static const char *verbosity_colors[] = { static const char *verbosity_colors[] = {
[L_SILENT] = "", [L_SILENT] = "",
@ -38,6 +38,10 @@ void set_log_level(log_importance_t verbosity) {
v = verbosity; v = verbosity;
} }
log_importance_t get_log_level(void) {
return v;
}
void reset_log_level(void) { void reset_log_level(void) {
v = loglevel_default; v = loglevel_default;
} }

View file

@ -11,6 +11,7 @@ typedef enum {
void init_log(log_importance_t verbosity); void init_log(log_importance_t verbosity);
void set_log_level(log_importance_t verbosity); void set_log_level(log_importance_t verbosity);
log_importance_t get_log_level(void);
void reset_log_level(void); void reset_log_level(void);
// returns whether debug logging is on after switching. // returns whether debug logging is on after switching.
bool toggle_debug_logging(void); bool toggle_debug_logging(void);

View file

@ -251,7 +251,7 @@ static struct cmd_results *cmd_bindsym(int argc, char **argv) {
} else { } else {
free_sway_binding(binding); free_sway_binding(binding);
return cmd_results_new(CMD_FAILURE, "bindsym", return cmd_results_new(CMD_FAILURE, "bindsym",
"Invalid bindsym command" "Invalid bindsym command "
"(expected more than 2 arguments, got %d)", argc); "(expected more than 2 arguments, got %d)", argc);
} }
} }
@ -317,7 +317,7 @@ static struct cmd_results *cmd_bindcode(int argc, char **argv) {
} else { } else {
free_sway_binding(binding); free_sway_binding(binding);
return cmd_results_new(CMD_FAILURE, "bindcode", return cmd_results_new(CMD_FAILURE, "bindcode",
"Invalid bindcode command" "Invalid bindcode command "
"(expected more than 2 arguments, got %d)", argc); "(expected more than 2 arguments, got %d)", argc);
} }
} }

View file

@ -853,12 +853,12 @@ swayc_t *swayc_tabbed_stacked_parent(swayc_t *view) {
if (!ASSERT_NONNULL(view)) { if (!ASSERT_NONNULL(view)) {
return NULL; return NULL;
} }
do { while (view->type != C_WORKSPACE && view->parent) {
view = view->parent; view = view->parent;
if (view->layout == L_TABBED || view->layout == L_STACKED) { if (view->layout == L_TABBED || view->layout == L_STACKED) {
parent = view; parent = view;
} }
} while (view && view->type != C_WORKSPACE); }
return parent; return parent;
} }

View file

@ -12,8 +12,6 @@
#include <stringop.h> #include <stringop.h>
#include "workspace.h" #include "workspace.h"
extern log_importance_t v;
/* XXX:DEBUG:XXX */ /* XXX:DEBUG:XXX */
static void container_log(const swayc_t *c, int depth) { static void container_log(const swayc_t *c, int depth) {
fprintf(stderr, "focus:%c", fprintf(stderr, "focus:%c",
@ -49,7 +47,7 @@ static void container_log(const swayc_t *c, int depth) {
fprintf(stderr, "name:%.16s\n", c->name); fprintf(stderr, "name:%.16s\n", c->name);
} }
void layout_log(const swayc_t *c, int depth) { void layout_log(const swayc_t *c, int depth) {
if (L_DEBUG > v) return; if (L_DEBUG > get_log_level()) return;
int i, d; int i, d;
int e = c->children ? c->children->length : 0; int e = c->children ? c->children->length : 0;
container_log(c, depth); container_log(c, depth);

View file

@ -198,11 +198,12 @@ static bool handle_view_created(wlc_handle handle) {
if (pid) { if (pid) {
// using newview as a temp storage location here, // using newview as a temp storage location here,
// rather than adding yet another workspace var // rather than adding yet another workspace var
if ((newview = workspace_for_pid(pid))) { newview = workspace_for_pid(pid);
if (newview && newview != current_ws) {
focused = newview; focused = newview;
newview = NULL;
return_to_workspace = true; return_to_workspace = true;
} }
newview = NULL;
} }
} }
@ -234,8 +235,12 @@ static bool handle_view_created(wlc_handle handle) {
switch (wlc_view_get_type(handle)) { switch (wlc_view_get_type(handle)) {
// regular view created regularly // regular view created regularly
case 0: case 0:
if (parent) {
newview = new_floating_view(handle);
} else {
newview = new_view(focused, handle); newview = new_view(focused, handle);
wlc_view_set_state(handle, WLC_BIT_MAXIMIZED, true); wlc_view_set_state(handle, WLC_BIT_MAXIMIZED, true);
}
break; break;
// Dmenu keeps viewfocus, but others with this flag don't, for now simulate // Dmenu keeps viewfocus, but others with this flag don't, for now simulate

View file

@ -11,6 +11,7 @@
#include <getopt.h> #include <getopt.h>
#include <signal.h> #include <signal.h>
#include <stdbool.h> #include <stdbool.h>
#include <unistd.h>
#include "client/window.h" #include "client/window.h"
#include "client/registry.h" #include "client/registry.h"