aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2017-11-11 18:06:50 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2017-11-11 18:06:50 -0500
commit0c8491f7d0c735299a25f0ab929f5d1e0866b929 (patch)
tree69fc808ce6b8ceda33e8fadcf7cbbc10b892ca00 /sway/tree
parentWire up output frame loop (diff)
downloadsway-0c8491f7d0c735299a25f0ab929f5d1e0866b929.tar.gz
sway-0c8491f7d0c735299a25f0ab929f5d1e0866b929.tar.zst
sway-0c8491f7d0c735299a25f0ab929f5d1e0866b929.zip
Initial (awful) pass on xdg shell support
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/container.c58
1 files changed, 32 insertions, 26 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 25bb858e..82c0d877 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -15,6 +15,7 @@
15#include "sway/input_state.h" 15#include "sway/input_state.h"
16#include "sway/ipc-server.h" 16#include "sway/ipc-server.h"
17#include "sway/output.h" 17#include "sway/output.h"
18#include "sway/view.h"
18#include "log.h" 19#include "log.h"
19#include "stringop.h" 20#include "stringop.h"
20 21
@@ -291,44 +292,49 @@ swayc_t *new_container(swayc_t *child, enum swayc_layouts layout) {
291 return cont; 292 return cont;
292} 293}
293 294
294swayc_t *new_view(swayc_t *sibling, wlc_handle handle) { 295swayc_t *new_view(swayc_t *sibling, struct sway_view *view) {
295 if (!ASSERT_NONNULL(sibling)) { 296 if (!ASSERT_NONNULL(sibling)) {
296 return NULL; 297 return NULL;
297 } 298 }
298 const char *title = wlc_view_get_title(handle); 299 const char *title = view->iface.get_prop(view, VIEW_PROP_TITLE);
299 swayc_t *view = new_swayc(C_VIEW); 300 swayc_t *swayc = new_swayc(C_VIEW);
300 sway_log(L_DEBUG, "Adding new view %" PRIuPTR ":%s to container %p %d", 301 sway_log(L_DEBUG, "Adding new view %p:%s to container %p %d",
301 handle, title, sibling, sibling ? sibling->type : 0); 302 swayc, title, sibling, sibling ? sibling->type : 0);
302 // Setup values 303 // Setup values
303 view->handle = handle; 304 swayc->_handle.view = view;
304 view->name = title ? strdup(title) : NULL; 305
305 const char *class = wlc_view_get_class(handle); 306 swayc->name = title ? strdup(title) : NULL;
306 view->class = class ? strdup(class) : NULL; 307
307 const char *instance = wlc_view_get_instance(handle); 308 const char *class = view->iface.get_prop(view, VIEW_PROP_CLASS);
308 view->instance = instance ? strdup(instance) : NULL; 309 swayc->class = class ? strdup(class) : NULL;
309 const char *app_id = wlc_view_get_app_id(handle); 310
310 view->app_id = app_id ? strdup(app_id) : NULL; 311 const char *instance = view->iface.get_prop(view, VIEW_PROP_INSTANCE);
311 view->visible = true; 312 swayc->instance = instance ? strdup(instance) : NULL;
312 view->is_focused = true; 313
313 view->sticky = false; 314 const char *app_id = view->iface.get_prop(view, VIEW_PROP_APP_ID);
314 view->width = 0; 315 swayc->app_id = app_id ? strdup(app_id) : NULL;
315 view->height = 0; 316
316 view->desired_width = -1; 317 swayc->visible = true;
317 view->desired_height = -1; 318 swayc->is_focused = true;
319 swayc->sticky = false;
320 swayc->width = 0;
321 swayc->height = 0;
322 swayc->desired_width = -1;
323 swayc->desired_height = -1;
318 // setup border 324 // setup border
319 view->border_type = config->border; 325 swayc->border_type = config->border;
320 view->border_thickness = config->border_thickness; 326 swayc->border_thickness = config->border_thickness;
321 327
322 view->is_floating = false; 328 swayc->is_floating = false;
323 329
324 if (sibling->type == C_WORKSPACE) { 330 if (sibling->type == C_WORKSPACE) {
325 // Case of focused workspace, just create as child of it 331 // Case of focused workspace, just create as child of it
326 add_child(sibling, view); 332 add_child(sibling, swayc);
327 } else { 333 } else {
328 // Regular case, create as sibling of current container 334 // Regular case, create as sibling of current container
329 add_sibling(sibling, view); 335 add_sibling(sibling, swayc);
330 } 336 }
331 return view; 337 return swayc;
332} 338}
333 339
334swayc_t *new_floating_view(wlc_handle handle) { 340swayc_t *new_floating_view(wlc_handle handle) {