summaryrefslogtreecommitdiff
path: root/src/platform/x11
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-13 14:14:28 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-13 14:14:28 +0300
commit339e1ad7adb8340732ee856d0f6f0d2c7f1455d1 (patch)
tree55d2735987f240e5eaacf6581ed3ce5db2c0e3a8 /src/platform/x11
parente185a9d719d469a0fd7edcf09a6342f7b10cbb8e (diff)
Inline trivial internal helpers at their call sites
Diffstat (limited to 'src/platform/x11')
-rw-r--r--src/platform/x11/window.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/src/platform/x11/window.c b/src/platform/x11/window.c
index 7891fff..347b4c2 100644
--- a/src/platform/x11/window.c
+++ b/src/platform/x11/window.c
@@ -145,11 +145,6 @@ struct x11_display {
} pending_drop;
};
-static struct x11_display *display_of(const struct yasl_surface *s)
-{
- return (struct x11_display *)s->display;
-}
-
static bool place(struct yasl_surface *base, struct yasl_vector2i at);
static void drag_end(struct x11_display *d, enum yasl_drag_end how);
static void drag_cancel(struct yasl_display *base);
@@ -368,7 +363,7 @@ static int pointer_button(unsigned button)
static void xi_pointer_event(struct x11_surface *s, const XIDeviceEvent *ev)
{
- struct x11_display *d = display_of(&s->base);
+ struct x11_display *d = (struct x11_display *)s->base.display;
struct x11_pointer *p = pointer_for(d, ev->sourceid);
struct yasl_mouse_event mouse = {
.pos = {yasl_scale_to_device(ev->event_x, YASL_SCALE_UNIT),
@@ -472,7 +467,7 @@ static bool resize(struct x11_surface *s, struct yasl_vector2i size)
(size_t)size.x > SIZE_MAX / sizeof(uint32_t) / (size_t)size.y)
return false;
if (s->image && size.x == s->size.x && size.y == s->size.y) return true;
- struct x11_display *d = display_of(&s->base);
+ struct x11_display *d = (struct x11_display *)s->base.display;
if (!d->native) {
s->size = size;
s->want_draw = true;
@@ -580,7 +575,7 @@ static void surface_destroy(struct yasl_surface *base)
{
struct x11_surface *s = (struct x11_surface *)base;
if (s->destroyed) return;
- struct x11_display *d = display_of(base);
+ struct x11_display *d = (struct x11_display *)base->display;
if (d->drag.active) {
if (d->drag.origin == s || d->drag.carried == s)
drag_end(d, YASL_DRAG_CANCELLED);
@@ -639,7 +634,7 @@ static void set_title(struct yasl_surface *base, const char *title)
{
struct x11_surface *s = (struct x11_surface *)base;
if (s->destroyed || !title) return;
- struct x11_display *d = display_of(base);
+ struct x11_display *d = (struct x11_display *)base->display;
XStoreName(d->native, s->window, title);
XChangeProperty(d->native, s->window, d->net_name, d->utf8, 8,
PropModeReplace, (const unsigned char *)title, (int)strlen(title));
@@ -648,7 +643,7 @@ static void set_title(struct yasl_surface *base, const char *title)
static void net_message(struct x11_surface *s, Atom type,
long a, long b, long c, long e, long f)
{
- struct x11_display *d = display_of(&s->base);
+ struct x11_display *d = (struct x11_display *)s->base.display;
XEvent event = {0};
event.xclient = (XClientMessageEvent){
.type = ClientMessage, .display = d->native, .window = s->window,
@@ -808,7 +803,7 @@ static struct yasl_surface *surface_create_popup(struct yasl_surface *parent_bas
struct x11_surface *parent = (struct x11_surface *)parent_base;
if (!parent || parent->destroyed || !popup_spec_valid(parent, spec))
return NULL;
- struct x11_display *d = display_of(parent_base);
+ struct x11_display *d = (struct x11_display *)parent_base->display;
struct x11_surface *s = calloc(1, sizeof(*s));
if (!s) return NULL;
s->base.display = parent_base->display;
@@ -874,7 +869,7 @@ static bool surface_popup_reposition(struct yasl_surface *popup_base,
if (!s || s->destroyed || !s->is_popup || !s->parent || s->parent->destroyed ||
!popup_spec_valid(s->parent, spec))
return false;
- struct x11_display *d = display_of(popup_base);
+ struct x11_display *d = (struct x11_display *)popup_base->display;
if (spec->size.x != s->size.x || spec->size.y != s->size.y) {
if (!resize(s, spec->size))
return false;
@@ -893,7 +888,7 @@ static bool surface_popup_reposition(struct yasl_surface *popup_base,
static void update_state(struct x11_surface *s)
{
- struct x11_display *d = display_of(&s->base);
+ struct x11_display *d = (struct x11_display *)s->base.display;
Atom actual;
int format;
unsigned long count, left;
@@ -1117,7 +1112,7 @@ static void refresh_keyboard(struct x11_display *d)
static void key_event(struct x11_surface *s, XKeyEvent *key, bool repeat)
{
- struct x11_display *d = display_of(&s->base);
+ struct x11_display *d = (struct x11_display *)s->base.display;
d->mods = modifiers(key->state);
unsigned clean_state = key->state & ~(Mod2Mask | LockMask);
KeySym sym = NoSymbol, base = NoSymbol, shifted = NoSymbol;
@@ -1431,7 +1426,7 @@ static bool present(struct yasl_surface *base, const struct yasl_framebuffer *fb
if (s->destroyed || !s->drawing || s->presented || !fb || !damage ||
fb->pixels != s->pixels || fb->size.x != s->size.x || fb->size.y != s->size.y ||
damage->n < -1 || damage->n > YASL_DAMAGE_MAX) return false;
- struct x11_display *d = display_of(base);
+ struct x11_display *d = (struct x11_display *)base->display;
XImage *im = s->image;
if (s->shm_active) {
if (damage->n == -1)
@@ -1740,7 +1735,7 @@ static void schedule_redraw(struct yasl_surface *base)
struct x11_surface *s = (struct x11_surface *)base;
if (!s->destroyed) {
s->want_draw = true;
- struct x11_display *d = display_of(base);
+ struct x11_display *d = (struct x11_display *)base->display;
if (d && d->loop)
yasl_loop_kick(d->loop);
}
@@ -1779,7 +1774,7 @@ static void cursor(struct yasl_surface *base, enum yasl_cursor cursor)
XC_sb_h_double_arrow, XC_sb_v_double_arrow};
struct x11_surface *s = (struct x11_surface *)base;
if (s->destroyed || (unsigned)cursor > YASL_CURSOR_HIDDEN) return;
- struct x11_display *d = display_of(base);
+ struct x11_display *d = (struct x11_display *)base->display;
if (!d->native) return;
if (!d->cursors[cursor]) {
@@ -1800,7 +1795,7 @@ static void cursor(struct yasl_surface *base, enum yasl_cursor cursor)
static bool place(struct yasl_surface *base, struct yasl_vector2i at)
{
struct x11_surface *s = (struct x11_surface *)base;
- struct x11_display *d = display_of(base);
+ struct x11_display *d = (struct x11_display *)base->display;
Window root, child;
int root_x, root_y, x, y;
unsigned mask;
@@ -1925,7 +1920,7 @@ static void drag_cancel(struct yasl_display *base)
static bool drag_carry(struct yasl_surface *base, struct yasl_vector2i offset)
{
- struct x11_display *d = display_of(base);
+ struct x11_display *d = (struct x11_display *)base->display;
if (!d || !d->drag.active)
return false;
if (d->drag.icon_window && d->native) {
@@ -1944,7 +1939,7 @@ static bool drag_carry(struct yasl_surface *base, struct yasl_vector2i offset)
static bool interactive_move(struct yasl_surface *base)
{
struct x11_surface *s = (struct x11_surface *)base;
- struct x11_display *d = display_of(base);
+ struct x11_display *d = (struct x11_display *)base->display;
Window root, child;
int rx, ry, x, y;
unsigned mask;
@@ -1958,7 +1953,7 @@ static bool interactive_move(struct yasl_surface *base)
static bool interactive_resize(struct yasl_surface *base, enum yasl_resize_edge edge)
{
struct x11_surface *s = (struct x11_surface *)base;
- struct x11_display *d = display_of(base);
+ struct x11_display *d = (struct x11_display *)base->display;
Window root, child;
int rx, ry, x, y;
unsigned mask;
@@ -1986,7 +1981,7 @@ static bool interactive_resize(struct yasl_surface *base, enum yasl_resize_edge
static bool show_window_menu(struct yasl_surface *base, struct yasl_vector2i pos)
{
struct x11_surface *s = (struct x11_surface *)base;
- struct x11_display *d = display_of(base);
+ struct x11_display *d = (struct x11_display *)base->display;
if (s->destroyed || !d->native) return false;
Atom atom = XInternAtom(d->native, "_GTK_SHOW_WINDOW_MENU", False);
net_message(s, atom, s->window, pos.x, pos.y, 0, 0);