Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add hyprland specific methods (client capturing) #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
BasedOnStyle: Google
IndentWidth: 4
UseTab: Never

BreakBeforeBraces: Attach
BinPackParameters: false
BinPackArguments: false
ColumnLimit: 0

AlignAfterOpenBracket: BlockIndent

AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
AccessModifierOffset: -4
NamespaceIndentation: All

# Override Google style defaults
DerivePointerAlignment: false
PointerAlignment: Left

4 changes: 2 additions & 2 deletions examples/simple/simple.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* cc simple.c `pkg-config --libs --cflags libglace` */
#include <libglace/libglace.h>
/* cc simple.c `pkg-config --libs --cflags glace` */
#include <glace/glace.h>

static void on_client_chagend(GlaceClient* client) {
printf(
Expand Down
63 changes: 63 additions & 0 deletions glace/glace-client-private.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#pragma once

#ifndef __LIBGLACE_CLIENT_PRIVATE_H__
#define __LIBGLACE_CLIENT_PRIVATE_H__

#include "glace-client.h"
#include "glace-manager-private.h"

#define CLIENT_SET_CURRENT_PROP(client, prop, value) \
(client->priv->current_properties.prop = value)

#define CLIENT_SET_PENDING_PROP(client, prop, value) \
(client->priv->pending_properties.prop = value)

#define CLIENT_GET_CURRENT_PROP(client, prop) \
(client->priv->current_properties.prop)

#define CLIENT_GET_PENDING_PROP(client, prop) \
(client->priv->pending_properties.prop)

#define CLIENT_BRIDGE_PROPS(client, prop, PROP_UPPER) \
do { \
if (CLIENT_GET_CURRENT_PROP(client, prop) != CLIENT_GET_PENDING_PROP(client, prop)) { \
CLIENT_GET_CURRENT_PROP(client, prop) = CLIENT_GET_PENDING_PROP(client, prop); \
g_object_notify_by_pspec( \
G_OBJECT(client), \
glace_client_properties[GLACE_CLIENT_PROPERTY_##PROP_UPPER] \
); \
} \
} while (0)

#define CLIENT_SET_STATE_FOR_CASE(client, state, ENUM_M, prop) \
case ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_##ENUM_M: \
CLIENT_SET_PENDING_PROP(client, prop, true); \
break;

#define CLIENT_SET_DEFAULT_STATES(client) \
CLIENT_SET_PENDING_PROP(client, maximized, false); \
CLIENT_SET_PENDING_PROP(client, minimized, false); \
CLIENT_SET_PENDING_PROP(client, activated, false); \
CLIENT_SET_PENDING_PROP(client, fullscreen, false);

#define IF_INVALID_CLIENT(client) if (client == NULL || GLACE_IS_CLIENT(client) == false || client->priv->closed == true)

#define RETURN_IF_INVALID_CLIENT(client, r_value) \
do { \
IF_INVALID_CLIENT(client) { \
g_warning("[WARNING][CLIENT] function %s got an invalid client", __func__); \
return r_value; \
} \
} while (0)

// signal emitters
static void glace_client_signal_changed_emit(GlaceClient* self);
static void glace_client_signal_close_emit(GlaceClient* self);

// methods
static void glace_client_init(GlaceClient* self);
static void glace_client_class_init(GlaceClientClass* klass);

GlaceClient* glace_client_new(struct zwlr_foreign_toplevel_handle_v1* wlr_handle, GdkWaylandDisplay* gdk_display);

#endif /* __LIBGLACE_CLIENT_PRIVATE_H__ */
Loading