-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Listen to new surface and map / unmap events, but don't do anything with them yet.
- Loading branch information
Showing
7 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <wayland-server-core.h> | ||
#include "hrt/hrt_server.h" | ||
|
||
struct hrt_view { | ||
struct wl_list link; | ||
struct wlr_xdg_toplevel *xdg_toplevel; | ||
struct wl_listener map; | ||
struct wl_listener unmap; | ||
struct wl_listener destroy; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#pragma once | ||
|
||
#include <wayland-server.h> | ||
|
||
void handle_new_xdg_surface(struct wl_listener *listener, void *data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ hrt_source_files += files( | |
'seat.c', | ||
'keyboard.c', | ||
'cursor.c', | ||
'xdg_shell.c', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include <stdlib.h> | ||
|
||
#include <wayland-server-core.h> | ||
#include <wayland-util.h> | ||
#include <wlr/util/log.h> | ||
|
||
#include "hrt/hrt_input.h" | ||
#include "xdg_impl.h" | ||
#include "hrt/hrt_view.h" | ||
|
||
#include <wlr/types/wlr_xdg_shell.h> | ||
|
||
static void handle_xdg_toplevel_map(struct wl_listener *listener, void *data) { | ||
wlr_log(WLR_DEBUG, "XDG Toplevel Mapped!"); | ||
} | ||
|
||
static void handle_xdg_toplevel_unmap(struct wl_listener *listener, | ||
void *data) { | ||
wlr_log(WLR_DEBUG, "XDG Toplevel unmapped!"); | ||
} | ||
|
||
static void handle_xdg_toplevel_destroy(struct wl_listener *listener, | ||
void *data) { | ||
wlr_log(WLR_DEBUG, "XDG Toplevel Destroyed!"); | ||
struct hrt_view *view = wl_container_of(listener, view, destroy); | ||
|
||
wl_list_remove(&view->map.link); | ||
wl_list_remove(&view->unmap.link); | ||
wl_list_remove(&view->destroy.link); | ||
|
||
free(view); | ||
} | ||
|
||
void handle_new_xdg_surface(struct wl_listener *listener, void *data) { | ||
wlr_log(WLR_DEBUG, "New XDG Surface recieved"); | ||
struct hrt_server *server = wl_container_of(listener, server, new_xdg_surface); | ||
struct wlr_xdg_surface *xdg_surface = data; | ||
|
||
if(xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) { | ||
return; | ||
} | ||
|
||
struct hrt_view *view = calloc(1, sizeof(struct hrt_view)); | ||
|
||
view->map.notify = handle_xdg_toplevel_map; | ||
wl_signal_add(&xdg_surface->events.map, &view->map); | ||
view->unmap.notify = handle_xdg_toplevel_unmap; | ||
wl_signal_add(&xdg_surface->events.unmap, &view->unmap); | ||
view->destroy.notify = handle_xdg_toplevel_destroy; | ||
wl_signal_add(&xdg_surface->events.destroy, &view->destroy); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters