Skip to content

Commit aa83ad7

Browse files
committed
init toplevel mapping
1 parent bb47939 commit aa83ad7

File tree

3 files changed

+128
-0
lines changed

3 files changed

+128
-0
lines changed

glace/glace-manager.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ static void glace_manager_class_init(GlaceManagerClass* klass) {
122122

123123
g_type_class_add_private(klass, sizeof(GlaceManagerPrivate));
124124

125+
// add public methods
126+
klass->capture_client = glace_manager_capture_client;
127+
125128
glace_manager_signals[GLACE_MANAGER_SIGNAL_CHANGED] = g_signal_new(
126129
"changed",
127130
GLACE_TYPE_MANAGER,
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<protocol name="hyprland_toplevel_mapping_v1">
3+
<copyright>
4+
Copyright © 2025 WhySoBad
5+
All rights reserved.
6+
7+
Redistribution and use in source and binary forms, with or without
8+
modification, are permitted provided that the following conditions are met:
9+
10+
1. Redistributions of source code must retain the above copyright notice, this
11+
list of conditions and the following disclaimer.
12+
13+
2. Redistributions in binary form must reproduce the above copyright notice,
14+
this list of conditions and the following disclaimer in the documentation
15+
and/or other materials provided with the distribution.
16+
17+
3. Neither the name of the copyright holder nor the names of its
18+
contributors may be used to endorse or promote products derived from
19+
this software without specific prior written permission.
20+
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
</copyright>
32+
33+
<description summary="mapping of toplevels to windows">
34+
This protocol allows clients to retrieve the mapping of toplevels to hyprland window addresses.
35+
</description>
36+
37+
<interface name="hyprland_toplevel_mapping_manager_v1" version="1">
38+
<description summary="manager to request toplevel mappings">
39+
This object is a manager which offers requests to retrieve a window address
40+
for a toplevel.
41+
</description>
42+
43+
<request name="get_window_for_toplevel">
44+
<description summary="get window address for toplevel">
45+
Get the window address for a toplevel.
46+
</description>
47+
<arg
48+
name="handle"
49+
type="new_id"
50+
interface="hyprland_toplevel_window_mapping_handle_v1"
51+
/>
52+
<arg
53+
name="toplevel"
54+
type="object"
55+
interface="ext_foreign_toplevel_handle_v1"
56+
summary="toplevel to get the window address for"
57+
/>
58+
</request>
59+
60+
<request name="get_window_for_toplevel_wlr">
61+
<description summary="get window address for wlr toplevel">
62+
Get the window address for a wlr toplevel.
63+
</description>
64+
<arg
65+
name="handle"
66+
type="new_id"
67+
interface="hyprland_toplevel_window_mapping_handle_v1"
68+
/>
69+
<arg
70+
name="toplevel"
71+
type="object"
72+
interface="zwlr_foreign_toplevel_handle_v1"
73+
summary="wlr toplevel to get the window address for"
74+
/>
75+
</request>
76+
77+
<request name="destroy" type="destructor">
78+
<description summary="destroy the manager">
79+
All objects created by the manager will still remain valid, until their appropriate destroy
80+
request has been called.
81+
</description>
82+
</request>
83+
</interface>
84+
85+
<interface name="hyprland_toplevel_window_mapping_handle_v1" version="1">
86+
<description summary="toplevel to window mapping">
87+
This object represents a mapping of a (wlr) toplevel to a window address.
88+
89+
Once created, the `window_address` event will be sent containing the address of the window
90+
associated with the toplevel.
91+
Should the mapping fail, the `failed` event will be sent.
92+
</description>
93+
94+
<event name="window_address">
95+
<description summary="address of the window">
96+
The full 64bit window address. The `address` field contains the lower 32 bits whilst the
97+
`address_hi` contains the upper 32 bits
98+
</description>
99+
<arg
100+
name="address_hi"
101+
type="uint"
102+
summary="upper 32 bits of the window address"
103+
/>
104+
<arg
105+
name="address"
106+
type="uint"
107+
summary="lower 32 bits of the window address"
108+
/>
109+
</event>
110+
111+
<event name="failed">
112+
<description summary="mapping failed">
113+
The mapping of the toplevel to a window address failed. Most likely the window does not
114+
exist (anymore).
115+
</description>
116+
</event>
117+
118+
<request name="destroy" type="destructor">
119+
<description summary="destroy handle">
120+
Destroy the handle. This request can be sent at any time by the client.
121+
</description>
122+
</request>
123+
</interface>
124+
</protocol>

protocol/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ wayland_dep = dependency('wayland-client')
22

33
protocol_names = [
44
'wlr-foreign-toplevel-management-unstable-v1',
5+
'hyprland-toplevel-mapping-v1',
56
'hyprland-toplevel-export-v1',
67
]
78

0 commit comments

Comments
 (0)