summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2015-08-17 13:09:44 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2015-08-17 13:09:44 -0400
commit107f961752641ca81cfb38a95948ea8fd0f236af (patch)
tree4e71c6fa01a1e68997c985e221307a11af67490c
parentMerge pull request #54 from Luminarys/master (diff)
parentfixed when views dont have names. (diff)
downloadsway-107f961752641ca81cfb38a95948ea8fd0f236af.tar.gz
sway-107f961752641ca81cfb38a95948ea8fd0f236af.tar.zst
sway-107f961752641ca81cfb38a95948ea8fd0f236af.zip
Merge pull request #55 from taiyu-len/master
fixed when views dont have names.
-rw-r--r--sway/container.c10
-rw-r--r--sway/handlers.c7
2 files changed, 10 insertions, 7 deletions
diff --git a/sway/container.c b/sway/container.c
index 231876c5..f10fbecf 100644
--- a/sway/container.c
+++ b/sway/container.c
@@ -54,9 +54,7 @@ swayc_t *new_output(wlc_handle handle) {
54 output->width = size->w; 54 output->width = size->w;
55 output->height = size->h; 55 output->height = size->h;
56 output->handle = handle; 56 output->handle = handle;
57 if (name) { 57 output->name = name ? strdup(name) : NULL;
58 output->name = strdup(name);
59 }
60 58
61 add_child(&root_container, output); 59 add_child(&root_container, output);
62 60
@@ -95,7 +93,7 @@ swayc_t *new_container(swayc_t *child, enum swayc_layouts layout) {
95 cont->layout = layout; 93 cont->layout = layout;
96 cont->width = child->width; 94 cont->width = child->width;
97 cont->height = child->height; 95 cont->height = child->height;
98 cont->x = child->x; 96 cont->x = child->x;
99 cont->y = child->y; 97 cont->y = child->y;
100 cont->visible = child->visible; 98 cont->visible = child->visible;
101 99
@@ -132,7 +130,7 @@ swayc_t *new_view(swayc_t *sibling, wlc_handle handle) {
132 (unsigned int)handle, title, sibling, sibling?sibling->type:0); 130 (unsigned int)handle, title, sibling, sibling?sibling->type:0);
133 //Setup values 131 //Setup values
134 view->handle = handle; 132 view->handle = handle;
135 view->name = strdup(title); 133 view->name = title ? strdup(title) : NULL;
136 view->visible = true; 134 view->visible = true;
137 135
138 view->desired_width = -1; 136 view->desired_width = -1;
@@ -159,7 +157,7 @@ swayc_t *new_floating_view(wlc_handle handle) {
159 (unsigned int)handle, title); 157 (unsigned int)handle, title);
160 //Setup values 158 //Setup values
161 view->handle = handle; 159 view->handle = handle;
162 view->name = strdup(title); 160 view->name = title ? strdup(title) : NULL;
163 view->visible = true; 161 view->visible = true;
164 162
165 // Set the geometry of the floating view 163 // Set the geometry of the floating view
diff --git a/sway/handlers.c b/sway/handlers.c
index 77e8f237..b166b7a6 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -104,6 +104,7 @@ static bool handle_view_created(wlc_handle handle) {
104 // Float popups 104 // Float popups
105 if (type & WLC_BIT_POPUP) { 105 if (type & WLC_BIT_POPUP) {
106 swayc_t *view = new_floating_view(handle); 106 swayc_t *view = new_floating_view(handle);
107 wlc_view_set_state(handle, WLC_BIT_MAXIMIZED, false);
107 focus_view(view); 108 focus_view(view);
108 arrange_windows(active_workspace, -1, -1); 109 arrange_windows(active_workspace, -1, -1);
109 } 110 }
@@ -136,13 +137,17 @@ static void handle_view_destroyed(wlc_handle handle) {
136 focus_view(focus_pointer()); 137 focus_view(focus_pointer());
137 arrange_windows(active_workspace, -1, -1); 138 arrange_windows(active_workspace, -1, -1);
138 return; 139 return;
139 } 140 }
140 141
141 if (type & WLC_BIT_OVERRIDE_REDIRECT) { 142 if (type & WLC_BIT_OVERRIDE_REDIRECT) {
142 focus_view(focus_pointer()); 143 focus_view(focus_pointer());
143 arrange_windows(active_workspace, -1, -1); 144 arrange_windows(active_workspace, -1, -1);
144 return; 145 return;
145 } 146 }
147 if (type & WLC_BIT_POPUP) {
148 swayc_t *view = get_swayc_for_handle(handle, &root_container);
149 destroy_view(view);
150 }
146 } 151 }
147 swayc_t *view = get_swayc_for_handle(handle, &root_container); 152 swayc_t *view = get_swayc_for_handle(handle, &root_container);
148 swayc_t *parent; 153 swayc_t *parent;