Move window type from client_t to window_t
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
5b96d66634
commit
acc0ca624b
|
@ -1452,57 +1452,6 @@ luaA_client_get_content(lua_State *L, client_t *c)
|
|||
return retval;
|
||||
}
|
||||
|
||||
static int
|
||||
luaA_client_get_type(lua_State *L, client_t *c)
|
||||
{
|
||||
switch(c->type)
|
||||
{
|
||||
case WINDOW_TYPE_DESKTOP:
|
||||
lua_pushliteral(L, "desktop");
|
||||
break;
|
||||
case WINDOW_TYPE_DOCK:
|
||||
lua_pushliteral(L, "dock");
|
||||
break;
|
||||
case WINDOW_TYPE_SPLASH:
|
||||
lua_pushliteral(L, "splash");
|
||||
break;
|
||||
case WINDOW_TYPE_DIALOG:
|
||||
lua_pushliteral(L, "dialog");
|
||||
break;
|
||||
case WINDOW_TYPE_MENU:
|
||||
lua_pushliteral(L, "menu");
|
||||
break;
|
||||
case WINDOW_TYPE_TOOLBAR:
|
||||
lua_pushliteral(L, "toolbar");
|
||||
break;
|
||||
case WINDOW_TYPE_UTILITY:
|
||||
lua_pushliteral(L, "utility");
|
||||
break;
|
||||
case WINDOW_TYPE_DROPDOWN_MENU:
|
||||
lua_pushliteral(L, "dropdown_menu");
|
||||
break;
|
||||
case WINDOW_TYPE_POPUP_MENU:
|
||||
lua_pushliteral(L, "popup_menu");
|
||||
break;
|
||||
case WINDOW_TYPE_TOOLTIP:
|
||||
lua_pushliteral(L, "tooltip");
|
||||
break;
|
||||
case WINDOW_TYPE_NOTIFICATION:
|
||||
lua_pushliteral(L, "notification");
|
||||
break;
|
||||
case WINDOW_TYPE_COMBO:
|
||||
lua_pushliteral(L, "combo");
|
||||
break;
|
||||
case WINDOW_TYPE_DND:
|
||||
lua_pushliteral(L, "dnd");
|
||||
break;
|
||||
case WINDOW_TYPE_NORMAL:
|
||||
lua_pushliteral(L, "normal");
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
luaA_client_get_screen(lua_State *L, client_t *c)
|
||||
{
|
||||
|
@ -1773,7 +1722,7 @@ client_class_setup(lua_State *L)
|
|||
NULL);
|
||||
luaA_class_add_property(&client_class, "type",
|
||||
NULL,
|
||||
(lua_class_propfunc_t) luaA_client_get_type,
|
||||
(lua_class_propfunc_t) luaA_window_get_type,
|
||||
NULL);
|
||||
luaA_class_add_property(&client_class, "class",
|
||||
NULL,
|
||||
|
|
|
@ -38,29 +38,6 @@
|
|||
| XCB_EVENT_MASK_LEAVE_WINDOW \
|
||||
| XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT)
|
||||
|
||||
/** Windows type */
|
||||
typedef enum
|
||||
{
|
||||
WINDOW_TYPE_NORMAL = 0,
|
||||
WINDOW_TYPE_DESKTOP,
|
||||
WINDOW_TYPE_DOCK,
|
||||
WINDOW_TYPE_SPLASH,
|
||||
WINDOW_TYPE_DIALOG,
|
||||
/* The ones below may have TRANSIENT_FOR, but are not plain dialogs.
|
||||
* They were purposefully placed below DIALOG.
|
||||
*/
|
||||
WINDOW_TYPE_MENU,
|
||||
WINDOW_TYPE_TOOLBAR,
|
||||
WINDOW_TYPE_UTILITY,
|
||||
/* This ones are usually set on override-redirect windows. */
|
||||
WINDOW_TYPE_DROPDOWN_MENU,
|
||||
WINDOW_TYPE_POPUP_MENU,
|
||||
WINDOW_TYPE_TOOLTIP,
|
||||
WINDOW_TYPE_NOTIFICATION,
|
||||
WINDOW_TYPE_COMBO,
|
||||
WINDOW_TYPE_DND
|
||||
} window_type_t;
|
||||
|
||||
/** client_t type */
|
||||
struct client_t
|
||||
{
|
||||
|
@ -101,8 +78,6 @@ struct client_t
|
|||
bool skip_taskbar;
|
||||
/** True if the client cannot have focus */
|
||||
bool nofocus;
|
||||
/** The window type */
|
||||
window_type_t type;
|
||||
/** Window of the group leader */
|
||||
xcb_window_t group_window;
|
||||
/** Window holding command needed to start it (session management related) */
|
||||
|
|
|
@ -179,6 +179,64 @@ window_set_border_width(lua_State *L, int idx, int width)
|
|||
luaA_object_emit_signal(L, idx, "property::border_width", 0);
|
||||
}
|
||||
|
||||
/** Get the window type.
|
||||
* \param L The Lua VM state.
|
||||
* \param window The window object.
|
||||
* \return The number of elements pushed on stack.
|
||||
*/
|
||||
int
|
||||
luaA_window_get_type(lua_State *L, window_t *w)
|
||||
{
|
||||
switch(w->type)
|
||||
{
|
||||
case WINDOW_TYPE_DESKTOP:
|
||||
lua_pushliteral(L, "desktop");
|
||||
break;
|
||||
case WINDOW_TYPE_DOCK:
|
||||
lua_pushliteral(L, "dock");
|
||||
break;
|
||||
case WINDOW_TYPE_SPLASH:
|
||||
lua_pushliteral(L, "splash");
|
||||
break;
|
||||
case WINDOW_TYPE_DIALOG:
|
||||
lua_pushliteral(L, "dialog");
|
||||
break;
|
||||
case WINDOW_TYPE_MENU:
|
||||
lua_pushliteral(L, "menu");
|
||||
break;
|
||||
case WINDOW_TYPE_TOOLBAR:
|
||||
lua_pushliteral(L, "toolbar");
|
||||
break;
|
||||
case WINDOW_TYPE_UTILITY:
|
||||
lua_pushliteral(L, "utility");
|
||||
break;
|
||||
case WINDOW_TYPE_DROPDOWN_MENU:
|
||||
lua_pushliteral(L, "dropdown_menu");
|
||||
break;
|
||||
case WINDOW_TYPE_POPUP_MENU:
|
||||
lua_pushliteral(L, "popup_menu");
|
||||
break;
|
||||
case WINDOW_TYPE_TOOLTIP:
|
||||
lua_pushliteral(L, "tooltip");
|
||||
break;
|
||||
case WINDOW_TYPE_NOTIFICATION:
|
||||
lua_pushliteral(L, "notification");
|
||||
break;
|
||||
case WINDOW_TYPE_COMBO:
|
||||
lua_pushliteral(L, "combo");
|
||||
break;
|
||||
case WINDOW_TYPE_DND:
|
||||
lua_pushliteral(L, "dnd");
|
||||
break;
|
||||
case WINDOW_TYPE_NORMAL:
|
||||
lua_pushliteral(L, "normal");
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
luaA_window_set_border_width(lua_State *L, window_t *c)
|
||||
{
|
||||
|
|
|
@ -26,6 +26,29 @@
|
|||
#include "objects/button.h"
|
||||
#include "common/luaclass.h"
|
||||
|
||||
/** Windows type */
|
||||
typedef enum
|
||||
{
|
||||
WINDOW_TYPE_NORMAL = 0,
|
||||
WINDOW_TYPE_DESKTOP,
|
||||
WINDOW_TYPE_DOCK,
|
||||
WINDOW_TYPE_SPLASH,
|
||||
WINDOW_TYPE_DIALOG,
|
||||
/* The ones below may have TRANSIENT_FOR, but are not plain dialogs.
|
||||
* They were purposefully placed below DIALOG.
|
||||
*/
|
||||
WINDOW_TYPE_MENU,
|
||||
WINDOW_TYPE_TOOLBAR,
|
||||
WINDOW_TYPE_UTILITY,
|
||||
/* This ones are usually set on override-redirect windows. */
|
||||
WINDOW_TYPE_DROPDOWN_MENU,
|
||||
WINDOW_TYPE_POPUP_MENU,
|
||||
WINDOW_TYPE_TOOLTIP,
|
||||
WINDOW_TYPE_NOTIFICATION,
|
||||
WINDOW_TYPE_COMBO,
|
||||
WINDOW_TYPE_DND
|
||||
} window_type_t;
|
||||
|
||||
#define WINDOW_OBJECT_HEADER \
|
||||
LUA_OBJECT_HEADER \
|
||||
/** The X window number */ \
|
||||
|
@ -43,7 +66,9 @@
|
|||
/** Border color */ \
|
||||
xcolor_t border_color; \
|
||||
/** Border width */ \
|
||||
uint16_t border_width;
|
||||
uint16_t border_width; \
|
||||
/** The window type */ \
|
||||
window_type_t type;
|
||||
|
||||
/** Window structure */
|
||||
typedef struct
|
||||
|
@ -57,6 +82,7 @@ void window_class_setup(lua_State *);
|
|||
|
||||
void window_set_opacity(lua_State *, int, double);
|
||||
void window_set_border_width(lua_State *, int, int);
|
||||
int luaA_window_get_type(lua_State *, window_t *);
|
||||
|
||||
#endif
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
Loading…
Reference in New Issue