summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar taiyu <taiyu.len@gmail.com>2015-08-16 18:24:46 -0700
committerLibravatar taiyu <taiyu.len@gmail.com>2015-08-16 18:24:46 -0700
commit498cf268f712e0bc8d00cf9ef7e3886129904c67 (patch)
tree33d6e363beb1f5f1d1e3ad805586397402621635
parentMerge pull request #49 from taiyu-len/master (diff)
downloadsway-498cf268f712e0bc8d00cf9ef7e3886129904c67.tar.gz
sway-498cf268f712e0bc8d00cf9ef7e3886129904c67.tar.zst
sway-498cf268f712e0bc8d00cf9ef7e3886129904c67.zip
unmanaged views handled better
-rw-r--r--sway/container.c12
-rw-r--r--sway/handlers.c19
2 files changed, 16 insertions, 15 deletions
diff --git a/sway/container.c b/sway/container.c
index 3158b8b0..89958a4f 100644
--- a/sway/container.c
+++ b/sway/container.c
@@ -125,18 +125,10 @@ swayc_t *new_container(swayc_t *child, enum swayc_layouts layout) {
125} 125}
126 126
127swayc_t *new_view(swayc_t *sibling, wlc_handle handle) { 127swayc_t *new_view(swayc_t *sibling, wlc_handle handle) {
128 const uint32_t type = wlc_view_get_type(handle);
129 const char *title = wlc_view_get_title(handle); 128 const char *title = wlc_view_get_title(handle);
130 /* Skip if unmanaged window */
131 if ((type & WLC_BIT_OVERRIDE_REDIRECT) || (type & WLC_BIT_UNMANAGED) ||
132 (type & WLC_BIT_POPUP) || (type & WLC_BIT_MODAL) || (type & WLC_BIT_SPLASH)) {
133 sway_log(L_DEBUG, "Leaving view %d:%s alone (unmanaged)", handle, title);
134 return NULL;
135 }
136
137 swayc_t *view = new_swayc(C_VIEW); 129 swayc_t *view = new_swayc(C_VIEW);
138 sway_log(L_DEBUG, "Adding new view %d:%s:%d to container %p %d", 130 sway_log(L_DEBUG, "Adding new view %d:%s to container %p %d",
139 handle, title, type, sibling, sibling?sibling->type:0); 131 handle, title, sibling, sibling?sibling->type:0);
140 //Setup values 132 //Setup values
141 view->handle = handle; 133 view->handle = handle;
142 view->name = strdup(title); 134 view->name = strdup(title);
diff --git a/sway/handlers.c b/sway/handlers.c
index e57b791b..817f197e 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -87,17 +87,26 @@ static void handle_output_focused(wlc_handle output, bool focus) {
87 87
88static bool handle_view_created(wlc_handle handle) { 88static bool handle_view_created(wlc_handle handle) {
89 swayc_t *focused = get_focused_container(&root_container); 89 swayc_t *focused = get_focused_container(&root_container);
90 swayc_t *view = new_view(focused, handle); 90 uint32_t type = wlc_view_get_type(handle);
91 if (view) { 91 //If override_redirect/unmanaged/popup/modal/splach
92 if (type) {
93 sway_log(L_DEBUG,"Unmanaged window of type %x left alone", type);
94 wlc_view_set_state(handle, WLC_BIT_ACTIVATED, true);
95 if (type & WLC_BIT_UNMANAGED) {
96 return true;
97 }
98 //for things like Dmenu
99 if (type & WLC_BIT_OVERRIDE_REDIRECT) {
100 wlc_view_focus(handle);
101 }
102 } else {
103 swayc_t *view = new_view(focused, handle);
92 //Set maximize flag for windows. 104 //Set maximize flag for windows.
93 //TODO: floating windows have this unset 105 //TODO: floating windows have this unset
94 wlc_view_set_state(handle, WLC_BIT_MAXIMIZED, true); 106 wlc_view_set_state(handle, WLC_BIT_MAXIMIZED, true);
95 unfocus_all(&root_container); 107 unfocus_all(&root_container);
96 focus_view(view); 108 focus_view(view);
97 arrange_windows(view->parent, -1, -1); 109 arrange_windows(view->parent, -1, -1);
98 } else { //Unmanaged view
99 wlc_view_set_state(handle, WLC_BIT_ACTIVATED, true);
100 wlc_view_focus(handle);
101 } 110 }
102 if (wlc_view_get_state(focused->handle) & WLC_BIT_FULLSCREEN) { 111 if (wlc_view_get_state(focused->handle) & WLC_BIT_FULLSCREEN) {
103 unfocus_all(&root_container); 112 unfocus_all(&root_container);