kiwmi_view:raise() and :lower()
This commit disables auto-raising views on focus. It doesn't solve desktop_active_output possibly returning a wrong output.
This commit is contained in:
parent
7393f5abe5
commit
677fa4d01e
5 changed files with 66 additions and 6 deletions
|
@ -11,6 +11,8 @@
|
||||||
#include <wayland-server.h>
|
#include <wayland-server.h>
|
||||||
#include <wlr/render/wlr_renderer.h>
|
#include <wlr/render/wlr_renderer.h>
|
||||||
|
|
||||||
|
#include "desktop/view.h"
|
||||||
|
|
||||||
struct kiwmi_desktop {
|
struct kiwmi_desktop {
|
||||||
struct wlr_compositor *compositor;
|
struct wlr_compositor *compositor;
|
||||||
struct wlr_xdg_shell *xdg_shell;
|
struct wlr_xdg_shell *xdg_shell;
|
||||||
|
@ -33,6 +35,10 @@ struct kiwmi_desktop {
|
||||||
} events;
|
} events;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void desktop_raise_view(
|
||||||
|
struct kiwmi_desktop *desktop,
|
||||||
|
struct kiwmi_view *view,
|
||||||
|
bool raise);
|
||||||
bool desktop_init(struct kiwmi_desktop *desktop, struct wlr_renderer *renderer);
|
bool desktop_init(struct kiwmi_desktop *desktop, struct wlr_renderer *renderer);
|
||||||
void desktop_fini(struct kiwmi_desktop *desktop);
|
void desktop_fini(struct kiwmi_desktop *desktop);
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,20 @@
|
||||||
#include "input/input.h"
|
#include "input/input.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
desktop_raise_view(
|
||||||
|
struct kiwmi_desktop *desktop,
|
||||||
|
struct kiwmi_view *view,
|
||||||
|
bool raise)
|
||||||
|
{
|
||||||
|
wl_list_remove(&view->link);
|
||||||
|
if (raise) {
|
||||||
|
wl_list_insert(&desktop->views, &view->link);
|
||||||
|
} else {
|
||||||
|
wl_list_insert(desktop->views.prev, &view->link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
desktop_init(struct kiwmi_desktop *desktop, struct wlr_renderer *renderer)
|
desktop_init(struct kiwmi_desktop *desktop, struct wlr_renderer *renderer)
|
||||||
{
|
{
|
||||||
|
|
|
@ -74,16 +74,10 @@ seat_focus_view(struct kiwmi_seat *seat, struct kiwmi_view *view)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct kiwmi_desktop *desktop = view->desktop;
|
|
||||||
|
|
||||||
if (seat->focused_view) {
|
if (seat->focused_view) {
|
||||||
view_set_activated(seat->focused_view, false);
|
view_set_activated(seat->focused_view, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// move view to front
|
|
||||||
wl_list_remove(&view->link);
|
|
||||||
wl_list_insert(&desktop->views, &view->link);
|
|
||||||
|
|
||||||
seat->focused_view = view;
|
seat->focused_view = view;
|
||||||
view_set_activated(view, true);
|
view_set_activated(view, true);
|
||||||
seat_focus_surface(seat, view->wlr_surface);
|
seat_focus_surface(seat, view->wlr_surface);
|
||||||
|
|
|
@ -207,6 +207,24 @@ l_kiwmi_view_iresize(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
l_kiwmi_view_lower(lua_State *L)
|
||||||
|
{
|
||||||
|
struct kiwmi_object *obj =
|
||||||
|
*(struct kiwmi_object **)luaL_checkudata(L, 1, "kiwmi_view");
|
||||||
|
|
||||||
|
if (!obj->valid) {
|
||||||
|
return luaL_error(L, "kiwmi_view no longer valid");
|
||||||
|
}
|
||||||
|
|
||||||
|
struct kiwmi_view *view = obj->object;
|
||||||
|
struct kiwmi_desktop *desktop = view->desktop;
|
||||||
|
|
||||||
|
desktop_raise_view(desktop, view, false);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
l_kiwmi_view_move(lua_State *L)
|
l_kiwmi_view_move(lua_State *L)
|
||||||
{
|
{
|
||||||
|
@ -263,6 +281,24 @@ l_kiwmi_view_pos(lua_State *L)
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
l_kiwmi_view_raise(lua_State *L)
|
||||||
|
{
|
||||||
|
struct kiwmi_object *obj =
|
||||||
|
*(struct kiwmi_object **)luaL_checkudata(L, 1, "kiwmi_view");
|
||||||
|
|
||||||
|
if (!obj->valid) {
|
||||||
|
return luaL_error(L, "kiwmi_view no longer valid");
|
||||||
|
}
|
||||||
|
|
||||||
|
struct kiwmi_view *view = obj->object;
|
||||||
|
struct kiwmi_desktop *desktop = view->desktop;
|
||||||
|
|
||||||
|
desktop_raise_view(desktop, view, true);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
l_kiwmi_view_resize(lua_State *L)
|
l_kiwmi_view_resize(lua_State *L)
|
||||||
{
|
{
|
||||||
|
@ -413,10 +449,12 @@ static const luaL_Reg kiwmi_view_methods[] = {
|
||||||
{"hide", l_kiwmi_view_hide},
|
{"hide", l_kiwmi_view_hide},
|
||||||
{"imove", l_kiwmi_view_imove},
|
{"imove", l_kiwmi_view_imove},
|
||||||
{"iresize", l_kiwmi_view_iresize},
|
{"iresize", l_kiwmi_view_iresize},
|
||||||
|
{"lower", l_kiwmi_view_lower},
|
||||||
{"move", l_kiwmi_view_move},
|
{"move", l_kiwmi_view_move},
|
||||||
{"on", luaK_callback_register_dispatch},
|
{"on", luaK_callback_register_dispatch},
|
||||||
{"pid", l_kiwmi_view_pid},
|
{"pid", l_kiwmi_view_pid},
|
||||||
{"pos", l_kiwmi_view_pos},
|
{"pos", l_kiwmi_view_pos},
|
||||||
|
{"raise", l_kiwmi_view_raise},
|
||||||
{"resize", l_kiwmi_view_resize},
|
{"resize", l_kiwmi_view_resize},
|
||||||
{"show", l_kiwmi_view_show},
|
{"show", l_kiwmi_view_show},
|
||||||
{"size", l_kiwmi_view_size},
|
{"size", l_kiwmi_view_size},
|
||||||
|
|
|
@ -288,6 +288,10 @@ Starts an interactive move.
|
||||||
Starts an interactive resize.
|
Starts an interactive resize.
|
||||||
Takes a table containing the edges, that the resize is happening on.
|
Takes a table containing the edges, that the resize is happening on.
|
||||||
|
|
||||||
|
#### view:lower()
|
||||||
|
|
||||||
|
Moves the view to background.
|
||||||
|
|
||||||
#### view:move(lx, ly)
|
#### view:move(lx, ly)
|
||||||
|
|
||||||
Moves the view to the specified position.
|
Moves the view to the specified position.
|
||||||
|
@ -304,6 +308,10 @@ Returns the process ID of the client associated with the view.
|
||||||
|
|
||||||
Returns the position of the view (top-left corner).
|
Returns the position of the view (top-left corner).
|
||||||
|
|
||||||
|
#### view:raise()
|
||||||
|
|
||||||
|
Moves the view to foreground.
|
||||||
|
|
||||||
#### view:resize(width, height)
|
#### view:resize(width, height)
|
||||||
|
|
||||||
Resizes the view.
|
Resizes the view.
|
||||||
|
|
Loading…
Add table
Reference in a new issue