-
Notifications
You must be signed in to change notification settings - Fork 599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drawin: Add support for the desktop layer. #3750
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,7 @@ lua_class_t drawin_class; | |
* @field border_width Border width. | ||
* @field border_color Border color. | ||
* @field ontop On top of other windows. | ||
* @field desktop Below other windows and widgets. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. What widgets? |
||
* @field cursor The mouse cursor. | ||
* @field visible Visibility. | ||
* @field opacity The opacity of the drawin, between 0 and 1. | ||
|
@@ -101,6 +102,10 @@ lua_class_t drawin_class; | |
* @signal property::ontop | ||
*/ | ||
|
||
/** | ||
* @signal property::desktop | ||
*/ | ||
|
||
/** | ||
* @signal property::visible | ||
*/ | ||
|
@@ -504,6 +509,7 @@ luaA_drawin_geometry(lua_State *L) | |
|
||
|
||
LUA_OBJECT_EXPORT_PROPERTY(drawin, drawin_t, ontop, lua_pushboolean) | ||
LUA_OBJECT_EXPORT_PROPERTY(drawin, drawin_t, desktop, lua_pushboolean) | ||
LUA_OBJECT_EXPORT_PROPERTY(drawin, drawin_t, cursor, lua_pushstring) | ||
LUA_OBJECT_EXPORT_PROPERTY(drawin, drawin_t, visible, lua_pushboolean) | ||
|
||
|
@@ -584,16 +590,48 @@ luaA_drawin_get_height(lua_State *L, drawin_t *drawin) | |
* \param drawin The drawin object. | ||
* \return The number of elements pushed on stack. | ||
*/ | ||
static int | ||
luaA_drawin_set_ontop(lua_State *L, drawin_t *drawin) | ||
void | ||
drawin_set_ontop(lua_State *L, drawin_t *drawin, bool b) | ||
{ | ||
bool b = luaA_checkboolean(L, -1); | ||
if(b != drawin->ontop) | ||
{ | ||
if(b) | ||
drawin_set_desktop(L, drawin, false); | ||
drawin->ontop = b; | ||
stack_windows(); | ||
luaA_object_emit_signal(L, -3, "property::ontop", 0); | ||
} | ||
} | ||
|
||
/** Set the drawin on desktop status. | ||
* \param L The Lua VM state. | ||
* \param drawin The drawin object. | ||
* \return The number of elements pushed on stack. | ||
*/ | ||
void | ||
drawin_set_desktop(lua_State *L, drawin_t *drawin, bool b) | ||
{ | ||
if(b != drawin->desktop) | ||
{ | ||
if(b) | ||
drawin_set_ontop(L, drawin, false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't necessarily work. Lua could react to I think these "multiple exclusive states"-thing also came up in Somehow this feels like it should be an enum, but that would break the magic behind There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
correct, i mostly copied the code over from |
||
drawin->desktop = b; | ||
stack_windows(); | ||
luaA_object_emit_signal(L, -3, "property::desktop", 0); | ||
} | ||
} | ||
|
||
static int | ||
luaA_drawin_set_ontop(lua_State *L, drawin_t *drawin) | ||
{ | ||
drawin_set_ontop(L, drawin, luaA_checkboolean(L, -1)); | ||
return 0; | ||
} | ||
|
||
static int | ||
luaA_drawin_set_desktop(lua_State *L, drawin_t *drawin) | ||
{ | ||
drawin_set_desktop(L, drawin, luaA_checkboolean(L, -1)); | ||
return 0; | ||
} | ||
|
||
|
@@ -797,6 +835,10 @@ drawin_class_setup(lua_State *L) | |
(lua_class_propfunc_t) luaA_drawin_set_ontop, | ||
(lua_class_propfunc_t) luaA_drawin_get_ontop, | ||
(lua_class_propfunc_t) luaA_drawin_set_ontop); | ||
luaA_class_add_property(&drawin_class, "desktop", | ||
(lua_class_propfunc_t) luaA_drawin_set_desktop, | ||
(lua_class_propfunc_t) luaA_drawin_get_desktop, | ||
(lua_class_propfunc_t) luaA_drawin_set_desktop); | ||
luaA_class_add_property(&drawin_class, "cursor", | ||
(lua_class_propfunc_t) luaA_drawin_set_cursor, | ||
(lua_class_propfunc_t) luaA_drawin_get_cursor, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does
and widgets
refer to? Wiboxes/drawins are not ordered relative to widgets, are they? I'd just leave that part outThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would probably be better to say
and wiboxes
orand drawins
, or, as you said, just leave that part out entirely. not sure which one would be better. my bad for getting the terminology wrong lolThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now thinking about it,
and drawins
is probably not optimal, since there's not many places where drawins are explained in the docs, unlike wiboxes, which have a dedicated page.