wm/src/client.h

80 lines
2.3 KiB
C

/*
The GPLv3 License (GPLv3)
Copyright (c) 2022 Akos Horvath
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CLIENT_H
#define CLIENT_H
#include <X11/X.h>
#include <X11/Xlib.h>
#include <stdbool.h>
typedef struct Wm Wm;
typedef struct Workspace Workspace;
typedef struct Monitor Monitor;
typedef struct Client Client;
struct Client {
int x;
int y;
int w;
int h;
Workspace *ws;
bool hidden;
Monitor *m;
Window window;
Window frame;
Client *prev;
Client *next;
char *name;
bool focused;
bool has_border;
bool is_floating;
pid_t pid;
bool is_pid_set;
};
XWindowChanges wm_client_to_xwchanges(Client *c);
Client* wm_client_find(Wm* wm, Window w);
Client* wm_client_create(Wm *wm, Window w);
void wm_client_handle_window_types(Wm *wm, Client *c, XMapRequestEvent e);
void wm_client_hide(Wm *wm, Client *c);
void wm_client_show(Wm* wm, Client *c);
void wm_client_focus(Wm* wm, Client *c);
void wm_client_focus_dir(Wm* wm, Client *c, int dir);
void wm_client_swap_dir(Wm* wm, Client *c, int dir);
void wm_client_free(Wm *wm, Client *c);
void wm_client_kill(Wm *wm, Client *c);
void wm_client_set_atom(Wm *wm, Client *c, const char *name, const unsigned char *data,
Atom type, int nelements);
Atom wm_client_get_atom(Wm *wm, Client *c, const char *name, unsigned char **atom_ret,
unsigned long *nitems_ret);
Client* wm_client_get_dir_rel_c(Client *c, int dir);
Client* wm_client_get_focused(Wm* wm);
void wm_client_border(Wm* wm, Client *c);
void wm_client_border_focused(Wm* wm, Client *c);
void wm_monitor_clients_border(Wm* wm, Monitor *m);
bool wm_client_is_focused(Wm* wm, Client *c);
void wm_client_draw_frame(Wm *wm, Client *c);
void wm_monitor_draw_all_clients_frame(Wm* wm, Monitor *m);
#endif