|
|
@ -10,6 +10,7 @@
|
|
|
|
#include "handlers.h"
|
|
|
|
#include "handlers.h"
|
|
|
|
#include "stringop.h"
|
|
|
|
#include "stringop.h"
|
|
|
|
#include "workspace.h"
|
|
|
|
#include "workspace.h"
|
|
|
|
|
|
|
|
#include "container.h"
|
|
|
|
|
|
|
|
|
|
|
|
static struct wlc_origin mouse_origin;
|
|
|
|
static struct wlc_origin mouse_origin;
|
|
|
|
|
|
|
|
|
|
|
@ -95,10 +96,17 @@ static bool handle_view_created(wlc_handle handle) {
|
|
|
|
if (type & WLC_BIT_UNMANAGED) {
|
|
|
|
if (type & WLC_BIT_UNMANAGED) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//for things like Dmenu
|
|
|
|
// For things like Dmenu
|
|
|
|
if (type & WLC_BIT_OVERRIDE_REDIRECT) {
|
|
|
|
if (type & WLC_BIT_OVERRIDE_REDIRECT) {
|
|
|
|
wlc_view_focus(handle);
|
|
|
|
wlc_view_focus(handle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Float popups
|
|
|
|
|
|
|
|
if (type & WLC_BIT_POPUP) {
|
|
|
|
|
|
|
|
swayc_t *view = new_floating_view(handle);
|
|
|
|
|
|
|
|
focus_view(view);
|
|
|
|
|
|
|
|
arrange_windows(active_workspace, -1, -1);
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
swayc_t *view = new_view(focused, handle);
|
|
|
|
swayc_t *view = new_view(focused, handle);
|
|
|
|
//Set maximize flag for windows.
|
|
|
|
//Set maximize flag for windows.
|
|
|
@ -118,6 +126,24 @@ static bool handle_view_created(wlc_handle handle) {
|
|
|
|
|
|
|
|
|
|
|
|
static void handle_view_destroyed(wlc_handle handle) {
|
|
|
|
static void handle_view_destroyed(wlc_handle handle) {
|
|
|
|
sway_log(L_DEBUG, "Destroying window %u", (unsigned int)handle);
|
|
|
|
sway_log(L_DEBUG, "Destroying window %u", (unsigned int)handle);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Properly handle unmanaged views
|
|
|
|
|
|
|
|
uint32_t type = wlc_view_get_type(handle);
|
|
|
|
|
|
|
|
if (type) {
|
|
|
|
|
|
|
|
wlc_view_set_state(handle, WLC_BIT_ACTIVATED, true);
|
|
|
|
|
|
|
|
sway_log(L_DEBUG,"Unmanaged window of type %x was destroyed", type);
|
|
|
|
|
|
|
|
if (type & WLC_BIT_UNMANAGED) {
|
|
|
|
|
|
|
|
focus_view(focus_pointer());
|
|
|
|
|
|
|
|
arrange_windows(active_workspace, -1, -1);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (type & WLC_BIT_OVERRIDE_REDIRECT) {
|
|
|
|
|
|
|
|
focus_view(focus_pointer());
|
|
|
|
|
|
|
|
arrange_windows(active_workspace, -1, -1);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
swayc_t *view = get_swayc_for_handle(handle, &root_container);
|
|
|
|
swayc_t *view = get_swayc_for_handle(handle, &root_container);
|
|
|
|
swayc_t *parent;
|
|
|
|
swayc_t *parent;
|
|
|
|
swayc_t *focused = get_focused_container(&root_container);
|
|
|
|
swayc_t *focused = get_focused_container(&root_container);
|
|
|
@ -135,8 +161,23 @@ static void handle_view_focus(wlc_handle view, bool focus) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void handle_view_geometry_request(wlc_handle view, const struct wlc_geometry* geometry) {
|
|
|
|
static void handle_view_geometry_request(wlc_handle handle, const struct wlc_geometry* geometry) {
|
|
|
|
// deny that shit
|
|
|
|
// If the view is floating, then apply the geometry.
|
|
|
|
|
|
|
|
// Otherwise save the desired width/height for the view.
|
|
|
|
|
|
|
|
// This will not do anything for the time being as WLC improperly sends geometry requests
|
|
|
|
|
|
|
|
swayc_t *view = get_swayc_for_handle(handle, &root_container);
|
|
|
|
|
|
|
|
if (view) {
|
|
|
|
|
|
|
|
if (view->is_floating) {
|
|
|
|
|
|
|
|
view->width = geometry->size.w;
|
|
|
|
|
|
|
|
view->height = geometry->size.h;
|
|
|
|
|
|
|
|
view->x = geometry->origin.x;
|
|
|
|
|
|
|
|
view->y = geometry->origin.y;
|
|
|
|
|
|
|
|
arrange_windows(view->parent, -1, -1);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
view->desired_width = geometry->size.w;
|
|
|
|
|
|
|
|
view->desired_height = geometry->size.h;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void handle_view_state_request(wlc_handle view, enum wlc_view_state_bit state, bool toggle) {
|
|
|
|
static void handle_view_state_request(wlc_handle view, enum wlc_view_state_bit state, bool toggle) {
|
|
|
|