Compare commits
No commits in common. "4f8388f544e69673a949ee1d1180a1a384b62822" and "a569108d824b0c3f0ebc33d69dbeb7d9bb6df3f0" have entirely different histories.
4f8388f544
...
a569108d82
4129
digesting_libdecor.c
4129
digesting_libdecor.c
File diff suppressed because it is too large
Load Diff
|
|
@ -50,15 +50,6 @@
|
|||
#define STREQL(a,b) (((a)==0 && (b)==0) || \
|
||||
((a)!=0 && (b)!=0 && strcmp((a),(b))==0))
|
||||
|
||||
// mine
|
||||
|
||||
typedef struct Extent2D{
|
||||
int x;
|
||||
int y;
|
||||
int w;
|
||||
int h;
|
||||
} Extent2D;
|
||||
|
||||
// libdecor.h
|
||||
|
||||
struct libdecor_configuration;
|
||||
|
|
@ -86,13 +77,6 @@ enum libdecor_window_state {
|
|||
LIBDECOR_WINDOW_STATE_CONSTRAINED_BOTTOM = 1 << 12,
|
||||
};
|
||||
|
||||
#define LIBDECOR_WINDOW_STATE_NON_FLOATING (LIBDECOR_WINDOW_STATE_MAXIMIZED |\
|
||||
LIBDECOR_WINDOW_STATE_FULLSCREEN |\
|
||||
LIBDECOR_WINDOW_STATE_TILED_LEFT |\
|
||||
LIBDECOR_WINDOW_STATE_TILED_RIGHT |\
|
||||
LIBDECOR_WINDOW_STATE_TILED_TOP |\
|
||||
LIBDECOR_WINDOW_STATE_TILED_BOTTOM)
|
||||
|
||||
enum libdecor_resize_edge {
|
||||
LIBDECOR_RESIZE_EDGE_NONE,
|
||||
LIBDECOR_RESIZE_EDGE_TOP,
|
||||
|
|
@ -171,12 +155,94 @@ struct border_component {
|
|||
struct wl_subsurface *wl_subsurface;
|
||||
struct buffer *buffer;
|
||||
bool opaque;
|
||||
struct wl_list output_list;
|
||||
int scale;
|
||||
|
||||
struct wl_list child_components; /* border_component::link */
|
||||
struct wl_list link; /* border_component::child_components */
|
||||
};
|
||||
|
||||
struct libdecor_frame {
|
||||
//struct libdecor_frame;
|
||||
struct wl_list frame_link;
|
||||
|
||||
//struct libdecor_frame_private;
|
||||
int ref_count;
|
||||
|
||||
struct wl_surface *wl_surface;
|
||||
|
||||
void *user_data;
|
||||
|
||||
struct xdg_surface *xdg_surface;
|
||||
struct xdg_toplevel *xdg_toplevel;
|
||||
struct zxdg_toplevel_decoration_v1 *toplevel_decoration;
|
||||
|
||||
bool pending_map;
|
||||
|
||||
char *app_id;
|
||||
char *title;
|
||||
struct libdecor_limits content_limits;
|
||||
struct xdg_toplevel *parent;
|
||||
|
||||
struct libdecor_configuration *pending_configuration;
|
||||
|
||||
int frame_content_width;
|
||||
int frame_content_height;
|
||||
|
||||
enum libdecor_window_state frame_window_state;
|
||||
|
||||
bool has_decoration_mode;
|
||||
enum zxdg_toplevel_decoration_v1_mode decoration_mode;
|
||||
|
||||
enum libdecor_capabilities frame_capabilities;
|
||||
|
||||
enum libdecor_wm_capabilities wm_capabilities;
|
||||
|
||||
/* original limits for interactive resize */
|
||||
struct libdecor_limits interactive_limits;
|
||||
|
||||
bool visible;
|
||||
|
||||
//struct libdecor_frame_gtk;
|
||||
int gtk_content_width;
|
||||
int gtk_content_height;
|
||||
|
||||
enum libdecor_window_state gtk_window_state;
|
||||
|
||||
enum decoration_type decoration_type;
|
||||
|
||||
enum libdecor_capabilities gtk_capabilities;
|
||||
|
||||
struct border_component *active;
|
||||
struct border_component *touch_active;
|
||||
|
||||
struct border_component *focus;
|
||||
struct border_component *grab;
|
||||
|
||||
bool shadow_showing;
|
||||
struct border_component shadow;
|
||||
|
||||
GtkWidget *window; /* offscreen window for rendering */
|
||||
GtkWidget *header; /* header bar with widgets */
|
||||
struct border_component headerbar;
|
||||
struct header_element_data hdr_focus;
|
||||
|
||||
/* store pre-processed shadow tile */
|
||||
cairo_surface_t *shadow_blur;
|
||||
|
||||
struct wl_list gtk_link;
|
||||
|
||||
struct {
|
||||
enum titlebar_gesture_state state;
|
||||
int button_pressed_count;
|
||||
uint32_t first_pressed_button;
|
||||
uint32_t first_pressed_time;
|
||||
double pressed_x;
|
||||
double pressed_y;
|
||||
uint32_t pressed_serial;
|
||||
} titlebar_gesture;
|
||||
};
|
||||
|
||||
// #include "libdecor.c"
|
||||
|
||||
struct libdecor_state {
|
||||
|
|
@ -229,6 +295,7 @@ struct seat {
|
|||
struct wl_surface *cursor_surface;
|
||||
struct wl_cursor *current_cursor;
|
||||
int cursor_scale;
|
||||
struct wl_list cursor_outputs;
|
||||
|
||||
struct wl_cursor_theme *cursor_theme;
|
||||
/* cursors for resize edges and corners */
|
||||
|
|
@ -238,8 +305,7 @@ struct seat {
|
|||
struct wl_surface *pointer_focus;
|
||||
struct wl_surface *touch_focus;
|
||||
|
||||
int pointer_x;
|
||||
int pointer_y;
|
||||
int pointer_x, pointer_y;
|
||||
|
||||
uint32_t touch_down_time_stamp;
|
||||
|
||||
|
|
@ -250,6 +316,14 @@ struct seat {
|
|||
struct wl_list link;
|
||||
};
|
||||
|
||||
struct output {
|
||||
struct wl_output *wl_output;
|
||||
uint32_t id;
|
||||
int scale;
|
||||
|
||||
struct wl_list link;
|
||||
};
|
||||
|
||||
struct buffer {
|
||||
struct wl_buffer *wl_buffer;
|
||||
bool in_use;
|
||||
|
|
@ -264,6 +338,16 @@ struct buffer {
|
|||
int buffer_height;
|
||||
};
|
||||
|
||||
struct surface_output {
|
||||
struct output *output;
|
||||
struct wl_list link;
|
||||
};
|
||||
|
||||
struct cursor_output {
|
||||
struct output *output;
|
||||
struct wl_list link;
|
||||
};
|
||||
|
||||
enum titlebar_gesture {
|
||||
TITLEBAR_GESTURE_DOUBLE_CLICK,
|
||||
TITLEBAR_GESTURE_MIDDLE_CLICK,
|
||||
|
|
@ -272,20 +356,65 @@ enum titlebar_gesture {
|
|||
|
||||
|
||||
// libdecor.h
|
||||
void libdecor_frame_set_visibility(bool visible);
|
||||
void libdecor_frame_show_window_menu(struct wl_seat *wl_seat, uint32_t serial, int x, int y);
|
||||
void libdecor_frame_ref(struct libdecor_frame *frame);
|
||||
void libdecor_frame_unref(struct libdecor_frame *frame);
|
||||
void libdecor_frame_set_visibility(struct libdecor_frame *frame,
|
||||
bool visible);
|
||||
|
||||
void libdecor_frame_translate_coordinate(int surface_x, int surface_y, int *frame_x, int *frame_y);
|
||||
void libdecor_frame_set_title(struct libdecor_frame *frame,
|
||||
const char *title);
|
||||
void libdecor_frame_set_app_id(struct libdecor_frame *frame,
|
||||
const char *app_id);
|
||||
void libdecor_frame_show_window_menu(struct libdecor_frame *frame,
|
||||
struct wl_seat *wl_seat,
|
||||
uint32_t serial,
|
||||
int x,
|
||||
int y);
|
||||
|
||||
void libdecor_frame_resize(struct wl_seat *wl_seat, uint32_t serial, enum libdecor_resize_edge edge);
|
||||
void libdecor_frame_move(struct wl_seat *wl_seat, uint32_t serial);
|
||||
void libdecor_frame_commit(int w, int h, struct libdecor_configuration *configuration);
|
||||
void libdecor_frame_set_fullscreen(struct wl_output *output);
|
||||
void libdecor_frame_unset_fullscreen(void);
|
||||
void libdecor_frame_map(void);
|
||||
void libdecor_frame_popup_grab(struct libdecor_frame *frame,
|
||||
const char *seat_name);
|
||||
void libdecor_frame_popup_ungrab(struct libdecor_frame *frame,
|
||||
const char *seat_name);
|
||||
void libdecor_frame_translate_coordinate(struct libdecor_frame *frame,
|
||||
int surface_x, int surface_y,
|
||||
int *frame_x, int *frame_y);
|
||||
|
||||
void libdecor_frame_resize(struct libdecor_frame *frame,
|
||||
struct wl_seat *wl_seat,
|
||||
uint32_t serial,
|
||||
enum libdecor_resize_edge edge);
|
||||
void libdecor_frame_move(struct libdecor_frame *frame,
|
||||
struct wl_seat *wl_seat,
|
||||
uint32_t serial);
|
||||
void libdecor_frame_commit(struct libdecor_frame *frame,
|
||||
int w, int h,
|
||||
struct libdecor_configuration *configuration);
|
||||
void libdecor_frame_set_minimized(struct libdecor_frame *frame);
|
||||
void libdecor_frame_set_maximized(struct libdecor_frame *frame);
|
||||
void libdecor_frame_unset_maximized(struct libdecor_frame *frame);
|
||||
void libdecor_frame_set_fullscreen(struct libdecor_frame *frame,
|
||||
struct wl_output *output);
|
||||
void libdecor_frame_unset_fullscreen(struct libdecor_frame *frame);
|
||||
bool libdecor_frame_is_floating(struct libdecor_frame *frame);
|
||||
void libdecor_frame_close(struct libdecor_frame *frame);
|
||||
void libdecor_frame_map(struct libdecor_frame *frame);
|
||||
|
||||
bool libdecor_configuration_get_content_size(struct libdecor_configuration *configuration, int *width, int *height);
|
||||
bool libdecor_configuration_get_content_size(struct libdecor_configuration *configuration,
|
||||
struct libdecor_frame *frame,
|
||||
int *width,
|
||||
int *height);
|
||||
bool libdecor_configuration_get_window_state(struct libdecor_configuration *configuration,
|
||||
enum libdecor_window_state *window_state);
|
||||
|
||||
int libdecor_dispatch(int timeout);
|
||||
|
||||
// libdecor-plugin.h
|
||||
|
||||
int libdecor_state_get_content_width(struct libdecor_state *state);
|
||||
|
||||
int libdecor_state_get_content_height(struct libdecor_state *state);
|
||||
|
||||
enum libdecor_window_state libdecor_state_get_window_state(struct libdecor_state *state);
|
||||
|
||||
// #include "libdecor-cairo-blur.h"
|
||||
|
||||
|
|
@ -304,32 +433,32 @@ int libdecor_os_create_anonymous_file(off_t size);
|
|||
|
||||
// #include "libdecor.c"
|
||||
|
||||
static void init_shell_surface(void);
|
||||
static void init_shell_surface(struct libdecor_frame *frame);
|
||||
|
||||
static void do_map(void);
|
||||
static void set_capabilities(struct libdecor_frame *frame, const enum libdecor_capabilities new_capabilities);
|
||||
|
||||
// #include "plugins/gtk/libdecor-gtk.c"
|
||||
static void do_map(struct libdecor_frame *frame);
|
||||
|
||||
//#include "plugins/gtk/libdecor-gtk.c"
|
||||
|
||||
|
||||
static void init_wl_output( uint32_t id, uint32_t version);
|
||||
|
||||
static void output_removed(struct output *output);
|
||||
|
||||
static const char *libdecor_gtk_proxy_tag = "libdecor-gtk";
|
||||
|
||||
static void libdecor_plugin_gtk_frame_free(void);
|
||||
static void libdecor_plugin_gtk_frame_commit(struct libdecor_state *state, struct libdecor_configuration *configuration);
|
||||
static void libdecor_plugin_gtk_frame_get_border_size(enum libdecor_window_state window_state, int *left, int *right, int *top, int *bottom);
|
||||
static int libdecor_plugin_gtk_get_fd(void);
|
||||
static int libdecor_plugin_gtk_get_fd(void);
|
||||
static int libdecor_plugin_gtk_dispatch(int timeout);
|
||||
static void libdecor_plugin_gtk_set_handle_application_cursor(bool handle_cursor);
|
||||
static void libdecor_plugin_gtk_frame_free(struct libdecor_frame *frame);
|
||||
static void libdecor_plugin_gtk_frame_commit(struct libdecor_frame *frame, struct libdecor_state *state, struct libdecor_configuration *configuration);
|
||||
static void libdecor_plugin_gtk_frame_popup_grab(struct libdecor_frame *frame, const char *seat_name);
|
||||
static void libdecor_plugin_gtk_frame_popup_ungrab(struct libdecor_frame *frame, const char *seat_name);
|
||||
static bool libdecor_plugin_gtk_frame_get_border_size(struct libdecor_frame *frame, struct libdecor_configuration *configuration, int *left, int *right, int *top, int *bottom);
|
||||
|
||||
static bool update_local_cursor(struct seat *seat);
|
||||
static void draw_decoration(void);
|
||||
static void draw_header_button(cairo_t *cr, cairo_surface_t *surface, enum header_element button_type);
|
||||
static void redraw_scale(struct border_component *cmpnt);
|
||||
static void buffer_free(struct buffer *buffer);
|
||||
static void draw_border_component(struct border_component *border_component);
|
||||
|
||||
static bool own_proxy(void *proxy);
|
||||
static struct border_component * border_component_from_wl_surface(const struct wl_surface *surface);
|
||||
static struct header_element_data get_header_focus(const GtkHeaderBar *header_bar, const int x, const int y);
|
||||
static void draw_title_bar(void);
|
||||
enum libdecor_resize_edge component_edge(const struct border_component *cmpnt, const int pointer_x, const int pointer_y, const int margin);
|
||||
static void toggle_maximized(void);
|
||||
static void update_touch_focus(struct seat *seat, wl_fixed_t x, wl_fixed_t y);
|
||||
static void draw_decoration(struct libdecor_frame *frame);
|
||||
|
||||
// digesting_libdecor
|
||||
|
||||
|
|
@ -347,20 +476,23 @@ typedef struct Ctx{
|
|||
struct wl_shm *wl_shm;
|
||||
struct xdg_wm_base *xdg_wm_base;
|
||||
struct zxdg_decoration_manager_v1 *decoration_manager;
|
||||
struct wl_callback *wl_callback;
|
||||
|
||||
struct wl_list visible_frame_list;
|
||||
struct wl_list seat_list;
|
||||
struct wl_list output_list;
|
||||
|
||||
bool init_done;
|
||||
bool has_error;
|
||||
|
||||
bool has_argb;
|
||||
int double_click_time_ms;
|
||||
int drag_threshold;
|
||||
bool handle_cursor;
|
||||
|
||||
/* window */
|
||||
struct wl_surface *wl_surface;
|
||||
struct xdg_surface *xdg_surface;
|
||||
struct xdg_toplevel *xdg_toplevel;
|
||||
struct zxdg_toplevel_decoration_v1 *toplevel_decoration;
|
||||
struct libdecor_frame *frame;
|
||||
struct wl_egl_window *wl_egl_window;
|
||||
int configured;
|
||||
int w;
|
||||
|
|
@ -372,64 +504,6 @@ typedef struct Ctx{
|
|||
|
||||
int has_cached_config;
|
||||
struct libdecor_configuration cached_config;
|
||||
|
||||
//struct libdecor_frame_private;
|
||||
char *title;
|
||||
struct libdecor_limits content_limits;
|
||||
struct xdg_toplevel *parent;
|
||||
|
||||
struct libdecor_configuration *pending_configuration;
|
||||
|
||||
int frame_content_width;
|
||||
int frame_content_height;
|
||||
|
||||
enum libdecor_window_state frame_window_state;
|
||||
|
||||
bool has_decoration_mode;
|
||||
enum zxdg_toplevel_decoration_v1_mode decoration_mode;
|
||||
|
||||
enum libdecor_capabilities frame_capabilities;
|
||||
enum libdecor_wm_capabilities wm_capabilities;
|
||||
|
||||
/* original limits for interactive resize */
|
||||
struct libdecor_limits interactive_limits;
|
||||
bool visible;
|
||||
|
||||
//struct libdecor_frame_gtk;
|
||||
int gtk_content_width;
|
||||
int gtk_content_height;
|
||||
|
||||
enum libdecor_window_state gtk_window_state;
|
||||
|
||||
enum decoration_type decoration_type;
|
||||
|
||||
enum libdecor_capabilities gtk_capabilities;
|
||||
|
||||
struct border_component *active;
|
||||
struct border_component *touch_active;
|
||||
struct border_component *focus;
|
||||
struct border_component *grab;
|
||||
|
||||
bool shadow_showing;
|
||||
struct border_component shadow;
|
||||
|
||||
GtkWidget *window; /* offscreen window for rendering */
|
||||
GtkWidget *header; /* header bar with widgets */
|
||||
struct border_component headerbar;
|
||||
struct header_element_data hdr_focus;
|
||||
|
||||
/* store pre-processed shadow tile */
|
||||
cairo_surface_t *shadow_blur;
|
||||
|
||||
struct {
|
||||
enum titlebar_gesture_state state;
|
||||
int button_pressed_count;
|
||||
uint32_t first_pressed_button;
|
||||
uint32_t first_pressed_time;
|
||||
double pressed_x;
|
||||
double pressed_y;
|
||||
uint32_t pressed_serial;
|
||||
} titlebar_gesture;
|
||||
} Ctx;
|
||||
|
||||
#endif //DIGESTING_LIBDECOR_H
|
||||
|
|
|
|||
Loading…
Reference in New Issue