mirror of
https://cagebreak.project-repo.co/cagebreak.git
synced 2026-08-21 13:04:18 +02:00
Add ipc message on cursor switching tile
This commit is contained in:
parent
a8148690d6
commit
97ef5306a1
4 changed files with 30 additions and 8 deletions
1
output.c
1
output.c
|
|
@ -371,7 +371,6 @@ output_make_workspace_fullscreen(struct cg_output *output,int ws) {
|
|||
struct cg_server *server=output->server;
|
||||
struct cg_view *current_view = seat_get_focus(server->seat);
|
||||
|
||||
/* We are focused on the background */
|
||||
if(current_view == NULL||ws != output->curr_workspace) {
|
||||
struct cg_view *it = NULL;
|
||||
wl_list_for_each(it, &output->workspaces[ws]->views,
|
||||
|
|
|
|||
31
seat.c
31
seat.c
|
|
@ -634,6 +634,31 @@ process_cursor_motion(struct cg_seat *seat, uint32_t time) {
|
|||
}
|
||||
|
||||
wlr_idle_notify_activity(seat->server->idle, seat->seat);
|
||||
|
||||
/* Check if cursor switched tile */
|
||||
struct wlr_output *c_outp = wlr_output_layout_output_at(seat->server->output_layout,seat->cursor->x,seat->cursor->y);
|
||||
struct cg_output *cg_outp = NULL;
|
||||
wl_list_for_each(cg_outp,&seat->server->outputs,link) {
|
||||
if(cg_outp->wlr_output == c_outp) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
struct cg_tile *c_tile;
|
||||
bool first=true;
|
||||
for(c_tile = cg_outp->workspaces[cg_outp->curr_workspace]->focused_tile;
|
||||
first || c_tile != cg_outp->workspaces[cg_outp->curr_workspace]->focused_tile; c_tile = c_tile->next) {
|
||||
first = false;
|
||||
double ox=seat->cursor->x,oy=seat->cursor->y;
|
||||
wlr_output_layout_output_coords(seat->server->output_layout,c_outp,&ox,&oy);
|
||||
if(c_tile->tile.x<=ox&&c_tile->tile.y<=oy&&c_tile->tile.x+c_tile->tile.width>=ox&&c_tile->tile.y+c_tile->tile.height>=oy) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(seat->cursor_tile != NULL && seat->cursor_tile != c_tile) {
|
||||
ipc_send_event(seat->server, "{\"event_name\":\"cursor_switch_tile\",\"old_output\":\"%s\",\"old_tile\":\"%d\",\"new_output\":\"%s\",\"new_tile\":\"%d\"}",
|
||||
seat->cursor_tile->workspace->output->wlr_output->name, seat->cursor_tile->id,c_outp->name,c_tile->id);
|
||||
}
|
||||
seat->cursor_tile=c_tile;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -656,12 +681,6 @@ handle_cursor_motion(struct wl_listener *listener, void *data) {
|
|||
event->delta_y);
|
||||
process_cursor_motion(seat, event->time_msec);
|
||||
wlr_idle_notify_activity(seat->server->idle, seat->seat);
|
||||
struct wlr_output *c_outp = wlr_output_layout_output_at(seat->server->output_layout,seat->cursor->x,seat->cursor->y);
|
||||
if(seat->cursor_output != NULL && seat->cursor_output != c_outp) {
|
||||
ipc_send_event(seat->server, "{\"event_name\":\"cursor_switch_output\",\"old_output\":\"%s\",\"new_output\":\"%s\"}",
|
||||
seat->cursor_output->name, c_outp->name);
|
||||
}
|
||||
seat->cursor_output=c_outp;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
2
seat.h
2
seat.h
|
|
@ -28,7 +28,7 @@ struct cg_seat {
|
|||
uint16_t num_touch;
|
||||
|
||||
struct wlr_cursor *cursor;
|
||||
struct wlr_output *cursor_output;
|
||||
struct cg_tile *cursor_tile;
|
||||
struct wlr_xcursor_manager *xcursor_manager;
|
||||
struct wl_listener cursor_motion;
|
||||
struct wl_listener cursor_motion_absolute;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
#include <wlr/util/log.h>
|
||||
|
||||
#include "message.h"
|
||||
#include "seat.h"
|
||||
#include "output.h"
|
||||
#include "server.h"
|
||||
#include "workspace.h"
|
||||
|
|
@ -90,6 +91,9 @@ void
|
|||
workspace_free_tiles(struct cg_workspace *workspace) {
|
||||
workspace->focused_tile->prev->next = NULL;
|
||||
while(workspace->focused_tile != NULL) {
|
||||
if(workspace->output->server->running&&workspace->output->server->seat->cursor_tile==workspace->focused_tile) {
|
||||
workspace->output->server->seat->cursor_tile=NULL;
|
||||
}
|
||||
struct cg_tile *next = workspace->focused_tile->next;
|
||||
free(workspace->focused_tile);
|
||||
workspace->focused_tile = next;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue