yutani: Allow panel to inform compositor iconified window position/size

This commit is contained in:
K. Lange 2023-04-16 10:45:55 +09:00
parent fb79e34e39
commit 68cb3ee1e3
5 changed files with 45 additions and 0 deletions

View File

@ -3036,6 +3036,18 @@ int main(int argc, char * argv[]) {
TRACE("Copied text to clipbard (size=%d)", yg->clipboard_size);
}
break;
case YUTANI_MSG_WINDOW_PANEL_SIZE:
{
struct yutani_msg_window_panel_size * ps = (void *)m->data;
yutani_server_window_t * w = hashmap_get(yg->wids_to_windows, (void *)(uintptr_t)ps->wid);
if (w) {
w->icon_x = ps->x;
w->icon_y = ps->y;
w->icon_w = ps->w;
w->icon_h = ps->h;
}
}
break;
default:
{
TRACE("Unknown type: 0x%8x", m->type);

View File

@ -39,6 +39,7 @@ _Begin_C_Header
#define yutani_msg_buildx_window_resize_start_alloc(out) char _yutani_tmp_ ## LINE [sizeof(struct yutani_message) + sizeof(struct yutani_msg_window_resize_start)]; yutani_msg_t * out = (void *)&_yutani_tmp_ ## LINE;
#define yutani_msg_buildx_special_request_alloc(out) char _yutani_tmp_ ## LINE [sizeof(struct yutani_message) + sizeof(struct yutani_msg_special_request)]; yutani_msg_t * out = (void *)&_yutani_tmp_ ## LINE;
#define yutani_msg_buildx_clipboard_alloc(out, length) char _yutani_tmp_ ## LINE [sizeof(struct yutani_message) + sizeof(struct yutani_msg_clipboard)+length]; yutani_msg_t * out = (void *)&_yutani_tmp_ ## LINE;
#define yutani_msg_buildx_window_panel_size_alloc(out) char _yutani_tmp_ ## LINE [sizeof(struct yutani_message) + sizeof(struct yutani_msg_window_panel_size)]; yutani_msg_t * out = (void *)&_yutani_tmp_ ## LINE;
extern void yutani_msg_buildx_hello(yutani_msg_t * msg);
extern void yutani_msg_buildx_flip(yutani_msg_t * msg, yutani_wid_t wid);
@ -71,5 +72,6 @@ extern void yutani_msg_buildx_window_show_mouse(yutani_msg_t * msg, yutani_wid_t
extern void yutani_msg_buildx_window_resize_start(yutani_msg_t * msg, yutani_wid_t wid, yutani_scale_direction_t direction);
extern void yutani_msg_buildx_special_request(yutani_msg_t * msg, yutani_wid_t wid, uint32_t request);
extern void yutani_msg_buildx_clipboard(yutani_msg_t * msg, char * content);
extern void yutani_msg_buildx_window_panel_size(yutani_msg_t * msg, yutani_wid_t wid, int32_t x, int32_t y, int32_t w, int32_t h);
_End_C_Header

View File

@ -173,6 +173,8 @@ typedef struct YutaniServerWindow {
/* Window is hidden? */
int hidden;
int minimized;
int32_t icon_x, icon_y, icon_w, icon_h;
} yutani_server_window_t;
typedef struct YutaniGlobals {

View File

@ -256,6 +256,14 @@ struct yutani_msg_clipboard {
char content[];
};
struct yutani_msg_window_panel_size {
yutani_wid_t wid;
int32_t x;
int32_t y;
int32_t w;
int32_t h;
};
/* Magic value */
#define YUTANI_MSG__MAGIC 0xABAD1DEA
@ -294,6 +302,7 @@ struct yutani_msg_clipboard {
#define YUTANI_MSG_WINDOW_WARP_MOUSE 0x00000027
#define YUTANI_MSG_WINDOW_SHOW_MOUSE 0x00000028
#define YUTANI_MSG_WINDOW_RESIZE_START 0x00000029
#define YUTANI_MSG_WINDOW_PANEL_SIZE 0x0000002a
#define YUTANI_MSG_SESSION_END 0x00000030
@ -536,6 +545,7 @@ extern void yutani_window_resize_accept(yutani_t * yctx, yutani_window_t * windo
extern void yutani_window_resize_done(yutani_t * yctx, yutani_window_t * window);
extern void yutani_window_advertise(yutani_t * yctx, yutani_window_t * window, char * name);
extern void yutani_window_advertise_icon(yutani_t * yctx, yutani_window_t * window, char * name, char * icon);
extern void yutani_window_panel_size(yutani_t * yctx, yutani_wid_t wid, int32_t x, int32_t y, int32_t w, int32_t h);
extern void yutani_subscribe_windows(yutani_t * y);
extern void yutani_unsubscribe_windows(yutani_t * y);
extern void yutani_query_windows(yutani_t * y);

View File

@ -513,6 +513,19 @@ void yutani_msg_buildx_clipboard(yutani_msg_t * msg, char * content) {
memcpy(cl->content, content, strlen(content));
}
void yutani_msg_buildx_window_panel_size(yutani_msg_t * msg, yutani_wid_t wid, int32_t x, int32_t y, int32_t w, int32_t h) {
msg->magic = YUTANI_MSG__MAGIC;
msg->type = YUTANI_MSG_WINDOW_PANEL_SIZE;
msg->size = sizeof(struct yutani_message) + sizeof(struct yutani_msg_window_panel_size);
struct yutani_msg_window_panel_size * ps = (void *)msg->data;
ps->wid = wid;
ps->x = x;
ps->y = y;
ps->w = w;
ps->h = h;
}
int yutani_msg_send(yutani_t * y, yutani_msg_t * msg) {
return pex_reply(y->sock, msg->size, (char *)msg);
}
@ -1056,6 +1069,12 @@ void yutani_set_clipboard(yutani_t * yctx, char * content) {
}
}
void yutani_window_panel_size(yutani_t * yctx, yutani_wid_t wid, int32_t x, int32_t y, int32_t w, int32_t h) {
yutani_msg_buildx_window_panel_size_alloc(m);
yutani_msg_buildx_window_panel_size(m,wid,x,y,w,h);
yutani_msg_send(yctx, m);
}
/**
* yutani_open_clipboard
*