[digesting_libdecor] eliminate the allocation and pass-through of the plugin completely
parent
6fed08cea3
commit
6c6f116885
|
|
@ -117,7 +117,7 @@ wlevent__wl_registry_global(void *data, struct wl_registry *wl_registry,
|
||||||
else if (strcmp(interface, "wl_shm") == 0){
|
else if (strcmp(interface, "wl_shm") == 0){
|
||||||
ctx.wl_shm =
|
ctx.wl_shm =
|
||||||
wl_registry_bind(ctx.wl_registry, name, &wl_shm_interface, 1);
|
wl_registry_bind(ctx.wl_registry, name, &wl_shm_interface, 1);
|
||||||
wl_shm_add_listener(ctx.wl_shm, &shm_listener, ctx.plugin_gtk);
|
wl_shm_add_listener(ctx.wl_shm, &shm_listener, 0);
|
||||||
}
|
}
|
||||||
else if (strcmp(interface, "wl_seat") == 0){
|
else if (strcmp(interface, "wl_seat") == 0){
|
||||||
struct seat *seat;
|
struct seat *seat;
|
||||||
|
|
@ -128,7 +128,6 @@ wlevent__wl_registry_global(void *data, struct wl_registry *wl_registry,
|
||||||
|
|
||||||
seat = calloc(1, sizeof *seat);
|
seat = calloc(1, sizeof *seat);
|
||||||
seat->cursor_scale = 1;
|
seat->cursor_scale = 1;
|
||||||
seat->plugin_gtk = ctx.plugin_gtk;
|
|
||||||
wl_list_init(&seat->cursor_outputs);
|
wl_list_init(&seat->cursor_outputs);
|
||||||
wl_list_insert(&ctx.seat_list, &seat->link);
|
wl_list_insert(&ctx.seat_list, &seat->link);
|
||||||
seat->wl_seat = wl_registry_bind(ctx.wl_registry, name, &wl_seat_interface, 3);
|
seat->wl_seat = wl_registry_bind(ctx.wl_registry, name, &wl_seat_interface, 3);
|
||||||
|
|
@ -142,7 +141,6 @@ wlevent__wl_registry_global(void *data, struct wl_registry *wl_registry,
|
||||||
}
|
}
|
||||||
|
|
||||||
output = calloc(1, sizeof *output);
|
output = calloc(1, sizeof *output);
|
||||||
output->plugin_gtk = ctx.plugin_gtk;
|
|
||||||
wl_list_insert(&ctx.output_list, &output->link);
|
wl_list_insert(&ctx.output_list, &output->link);
|
||||||
output->id = name;
|
output->id = name;
|
||||||
output->wl_output = wl_registry_bind(ctx.wl_registry, name, &wl_output_interface, MIN(version, 3));
|
output->wl_output = wl_registry_bind(ctx.wl_registry, name, &wl_output_interface, MIN(version, 3));
|
||||||
|
|
@ -324,9 +322,6 @@ int main(){
|
||||||
*/
|
*/
|
||||||
|
|
||||||
{
|
{
|
||||||
ctx.plugin_gtk = calloc(1, sizeof *ctx.plugin_gtk);
|
|
||||||
libdecor_plugin_init(&ctx.plugin_gtk->plugin, >k_plugin_iface);
|
|
||||||
|
|
||||||
wl_list_init(&ctx.frames);
|
wl_list_init(&ctx.frames);
|
||||||
|
|
||||||
wl_list_init(&ctx.visible_frame_list);
|
wl_list_init(&ctx.visible_frame_list);
|
||||||
|
|
@ -373,18 +368,13 @@ int main(){
|
||||||
0);
|
0);
|
||||||
wl_display_roundtrip(ctx.wl_display);
|
wl_display_roundtrip(ctx.wl_display);
|
||||||
|
|
||||||
ctx.plugin = &ctx.plugin_gtk->plugin;
|
|
||||||
|
|
||||||
if (ctx.plugin == 0){
|
|
||||||
fprintf(stderr, "Failed to load static plugin: failed to init\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
wl_display_flush(ctx.wl_display);
|
wl_display_flush(ctx.wl_display);
|
||||||
}
|
}
|
||||||
|
|
||||||
int opengl_load_success = 0;
|
int opengl_load_success = 0;
|
||||||
if (ctx.plugin != 0){
|
if (ctx.wl_compositor != 0 &&
|
||||||
|
ctx.wl_subcompositor != 0 &&
|
||||||
|
ctx.wl_shm != 0){
|
||||||
/* (egl) eglGetDisplay
|
/* (egl) eglGetDisplay
|
||||||
** " obtains the EGL display connection for the native display "
|
** " obtains the EGL display connection for the native display "
|
||||||
*/
|
*/
|
||||||
|
|
@ -772,17 +762,16 @@ frame_get_window_size_for(struct libdecor_frame *frame,
|
||||||
int *window_height)
|
int *window_height)
|
||||||
{
|
{
|
||||||
struct libdecor_frame_private *frame_priv = frame->priv;
|
struct libdecor_frame_private *frame_priv = frame->priv;
|
||||||
struct libdecor_plugin *plugin = ctx.plugin;
|
|
||||||
|
|
||||||
*window_width = state->content_width;
|
*window_width = state->content_width;
|
||||||
*window_height = state->content_height;
|
*window_height = state->content_height;
|
||||||
|
|
||||||
if (frame_has_visible_client_side_decoration(frame) &&
|
if (frame_has_visible_client_side_decoration(frame)) {
|
||||||
plugin->priv->iface->frame_get_border_size) {
|
|
||||||
int left, right, top, bottom;
|
int left, right, top, bottom;
|
||||||
if (!plugin->priv->iface->frame_get_border_size(
|
if (!libdecor_plugin_gtk_frame_get_border_size(0, frame, NULL,
|
||||||
plugin, frame, NULL, &left, &right, &top, &bottom))
|
&left, &right, &top, &bottom)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
*window_width += left + right;
|
*window_width += left + right;
|
||||||
*window_height += top + bottom;
|
*window_height += top + bottom;
|
||||||
}
|
}
|
||||||
|
|
@ -794,15 +783,12 @@ static void
|
||||||
frame_set_window_geometry(struct libdecor_frame *frame,
|
frame_set_window_geometry(struct libdecor_frame *frame,
|
||||||
int32_t content_width, int32_t content_height)
|
int32_t content_width, int32_t content_height)
|
||||||
{
|
{
|
||||||
struct libdecor_plugin *plugin = ctx.plugin;
|
|
||||||
int x, y, width, height;
|
int x, y, width, height;
|
||||||
int left, right, top, bottom;
|
int left, right, top, bottom;
|
||||||
|
|
||||||
if (frame_has_visible_client_side_decoration(frame) &&
|
if (frame_has_visible_client_side_decoration(frame) &&
|
||||||
plugin->priv->iface->frame_get_border_size(plugin, frame,
|
libdecor_plugin_gtk_frame_get_border_size(0, frame, NULL,
|
||||||
NULL,
|
&left, &right, &top, &bottom)) {
|
||||||
&left, &right,
|
|
||||||
&top, &bottom)) {
|
|
||||||
x = -left;
|
x = -left;
|
||||||
y = -top;
|
y = -top;
|
||||||
width = content_width + left + right;
|
width = content_width + left + right;
|
||||||
|
|
@ -823,8 +809,6 @@ libdecor_configuration_get_content_size(struct libdecor_configuration *configura
|
||||||
int *width,
|
int *width,
|
||||||
int *height)
|
int *height)
|
||||||
{
|
{
|
||||||
struct libdecor_plugin *plugin = ctx.plugin;
|
|
||||||
|
|
||||||
/* get configured toplevel dimensions */
|
/* get configured toplevel dimensions */
|
||||||
if (!configuration->has_size)
|
if (!configuration->has_size)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -836,15 +820,14 @@ libdecor_configuration_get_content_size(struct libdecor_configuration *configura
|
||||||
*height = configuration->window_height;
|
*height = configuration->window_height;
|
||||||
|
|
||||||
/* remove plugin-specific border size */
|
/* remove plugin-specific border size */
|
||||||
if (frame_has_visible_client_side_decoration(frame) &&
|
if (frame_has_visible_client_side_decoration(frame)) {
|
||||||
plugin->priv->iface->frame_get_border_size) {
|
|
||||||
int left, right, top, bottom;
|
int left, right, top, bottom;
|
||||||
|
|
||||||
/* Update window state for correct border size calculation */
|
/* Update window state for correct border size calculation */
|
||||||
frame->priv->window_state = configuration->window_state;
|
frame->priv->window_state = configuration->window_state;
|
||||||
if (!plugin->priv->iface->frame_get_border_size(
|
if (!libdecor_plugin_gtk_frame_get_border_size(0, frame, configuration, &left, &right, &top, &bottom)){
|
||||||
plugin, frame, configuration, &left, &right, &top, &bottom))
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
*width -= (left + right);
|
*width -= (left + right);
|
||||||
*height -= (top + bottom);
|
*height -= (top + bottom);
|
||||||
|
|
@ -998,12 +981,10 @@ xdg_toplevel_configure_bounds(void *user_data,
|
||||||
{
|
{
|
||||||
struct libdecor_frame *frame = user_data;
|
struct libdecor_frame *frame = user_data;
|
||||||
struct libdecor_frame_private *frame_priv = frame->priv;
|
struct libdecor_frame_private *frame_priv = frame->priv;
|
||||||
struct libdecor_plugin *plugin = ctx.plugin;
|
|
||||||
int left = 0, top = 0, right = 0, bottom = 0;
|
int left = 0, top = 0, right = 0, bottom = 0;
|
||||||
|
|
||||||
if (frame_has_visible_client_side_decoration(frame) &&
|
if (frame_has_visible_client_side_decoration(frame)) {
|
||||||
plugin->priv->iface->frame_get_border_size) {
|
libdecor_plugin_gtk_frame_get_border_size(0, frame, NULL,
|
||||||
plugin->priv->iface->frame_get_border_size(plugin, frame, NULL,
|
|
||||||
&left, &right, &top, &bottom);
|
&left, &right, &top, &bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1136,16 +1117,17 @@ init_shell_surface(struct libdecor_frame *frame)
|
||||||
|
|
||||||
struct libdecor_frame *
|
struct libdecor_frame *
|
||||||
libdecor_decorate(struct wl_surface *wl_surface, void *user_data){
|
libdecor_decorate(struct wl_surface *wl_surface, void *user_data){
|
||||||
struct libdecor_plugin *plugin = ctx.plugin;
|
|
||||||
struct libdecor_frame *frame;
|
struct libdecor_frame *frame;
|
||||||
struct libdecor_frame_private *frame_priv;
|
struct libdecor_frame_private *frame_priv;
|
||||||
|
|
||||||
if (ctx.has_error)
|
if (ctx.has_error){
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
frame = plugin->priv->iface->frame_new(plugin);
|
frame = libdecor_plugin_gtk_frame_new(0);
|
||||||
if (!frame)
|
if (!frame){
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
frame_priv = calloc(1, sizeof *frame_priv);
|
frame_priv = calloc(1, sizeof *frame_priv);
|
||||||
frame->priv = frame_priv;
|
frame->priv = frame_priv;
|
||||||
|
|
@ -1191,8 +1173,6 @@ libdecor_frame_unref(struct libdecor_frame *frame)
|
||||||
|
|
||||||
frame_priv->ref_count--;
|
frame_priv->ref_count--;
|
||||||
if (frame_priv->ref_count == 0) {
|
if (frame_priv->ref_count == 0) {
|
||||||
struct libdecor_plugin *plugin = ctx.plugin;
|
|
||||||
|
|
||||||
if (ctx.decoration_manager && frame_priv->toplevel_decoration) {
|
if (ctx.decoration_manager && frame_priv->toplevel_decoration) {
|
||||||
zxdg_toplevel_decoration_v1_destroy(frame_priv->toplevel_decoration);
|
zxdg_toplevel_decoration_v1_destroy(frame_priv->toplevel_decoration);
|
||||||
frame_priv->toplevel_decoration = NULL;
|
frame_priv->toplevel_decoration = NULL;
|
||||||
|
|
@ -1205,7 +1185,7 @@ libdecor_frame_unref(struct libdecor_frame *frame)
|
||||||
if (frame_priv->xdg_surface)
|
if (frame_priv->xdg_surface)
|
||||||
xdg_surface_destroy(frame_priv->xdg_surface);
|
xdg_surface_destroy(frame_priv->xdg_surface);
|
||||||
|
|
||||||
plugin->priv->iface->frame_free(plugin, frame);
|
libdecor_plugin_gtk_frame_free(0, frame);
|
||||||
|
|
||||||
free(frame_priv->state.title);
|
free(frame_priv->state.title);
|
||||||
free(frame_priv->state.app_id);
|
free(frame_priv->state.app_id);
|
||||||
|
|
@ -1233,7 +1213,6 @@ libdecor_frame_set_visibility(struct libdecor_frame *frame,
|
||||||
bool visible)
|
bool visible)
|
||||||
{
|
{
|
||||||
struct libdecor_frame_private *frame_priv = frame->priv;
|
struct libdecor_frame_private *frame_priv = frame->priv;
|
||||||
struct libdecor_plugin *plugin = ctx.plugin;
|
|
||||||
|
|
||||||
frame_priv->visible = visible;
|
frame_priv->visible = visible;
|
||||||
|
|
||||||
|
|
@ -1261,10 +1240,10 @@ libdecor_frame_set_visibility(struct libdecor_frame *frame,
|
||||||
/* enable/disable decorations that are managed by a plugin */
|
/* enable/disable decorations that are managed by a plugin */
|
||||||
if (frame_has_visible_client_side_decoration(frame)) {
|
if (frame_has_visible_client_side_decoration(frame)) {
|
||||||
/* show client-side decorations */
|
/* show client-side decorations */
|
||||||
plugin->priv->iface->frame_commit(plugin, frame, NULL, NULL);
|
libdecor_plugin_gtk_frame_commit(0, frame, NULL, NULL);
|
||||||
} else {
|
} else {
|
||||||
/* destroy client-side decorations */
|
/* destroy client-side decorations */
|
||||||
plugin->priv->iface->frame_free(plugin, frame);
|
libdecor_plugin_gtk_frame_free(0, frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
frame_set_window_geometry(frame,
|
frame_set_window_geometry(frame,
|
||||||
|
|
@ -1300,18 +1279,18 @@ libdecor_frame_set_title(struct libdecor_frame *frame,
|
||||||
const char *title)
|
const char *title)
|
||||||
{
|
{
|
||||||
struct libdecor_frame_private *frame_priv = frame->priv;
|
struct libdecor_frame_private *frame_priv = frame->priv;
|
||||||
struct libdecor_plugin *plugin = ctx.plugin;
|
|
||||||
|
|
||||||
if (!streql(frame_priv->state.title, title)) {
|
if (!streql(frame_priv->state.title, title)) {
|
||||||
free(frame_priv->state.title);
|
free(frame_priv->state.title);
|
||||||
frame_priv->state.title = strdup(title);
|
frame_priv->state.title = strdup(title);
|
||||||
|
|
||||||
if (!frame_priv->xdg_toplevel)
|
if (!frame_priv->xdg_toplevel){
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
xdg_toplevel_set_title(frame_priv->xdg_toplevel, title);
|
xdg_toplevel_set_title(frame_priv->xdg_toplevel, title);
|
||||||
|
|
||||||
plugin->priv->iface->frame_property_changed(plugin, frame);
|
libdecor_plugin_gtk_frame_property_changed(0, frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1340,7 +1319,6 @@ static void
|
||||||
notify_on_capability_change(struct libdecor_frame *frame,
|
notify_on_capability_change(struct libdecor_frame *frame,
|
||||||
const enum libdecor_capabilities old_capabilities)
|
const enum libdecor_capabilities old_capabilities)
|
||||||
{
|
{
|
||||||
struct libdecor_plugin *plugin = ctx.plugin;
|
|
||||||
struct libdecor_state *state;
|
struct libdecor_state *state;
|
||||||
|
|
||||||
if (frame->priv->capabilities == old_capabilities)
|
if (frame->priv->capabilities == old_capabilities)
|
||||||
|
|
@ -1350,7 +1328,7 @@ notify_on_capability_change(struct libdecor_frame *frame,
|
||||||
frame->priv->content_height == 0)
|
frame->priv->content_height == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
plugin->priv->iface->frame_property_changed(plugin, frame);
|
libdecor_plugin_gtk_frame_property_changed(0, frame);
|
||||||
|
|
||||||
if (!libdecor_frame_has_capability(frame, LIBDECOR_ACTION_RESIZE)) {
|
if (!libdecor_frame_has_capability(frame, LIBDECOR_ACTION_RESIZE)) {
|
||||||
frame->priv->interactive_limits = frame->priv->state.content_limits;
|
frame->priv->interactive_limits = frame->priv->state.content_limits;
|
||||||
|
|
@ -1399,30 +1377,20 @@ libdecor_frame_unset_capabilities(struct libdecor_frame *frame,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
libdecor_frame_has_capability(struct libdecor_frame *frame,
|
libdecor_frame_has_capability(struct libdecor_frame *frame, enum libdecor_capabilities capability){
|
||||||
enum libdecor_capabilities capability)
|
|
||||||
{
|
|
||||||
return frame->priv->capabilities & capability;
|
return frame->priv->capabilities & capability;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
libdecor_frame_popup_grab(struct libdecor_frame *frame,
|
libdecor_frame_popup_grab(struct libdecor_frame *frame, const char *seat_name){
|
||||||
const char *seat_name)
|
|
||||||
{
|
|
||||||
struct libdecor_frame_private *frame_priv = frame->priv;
|
struct libdecor_frame_private *frame_priv = frame->priv;
|
||||||
struct libdecor_plugin *plugin = ctx.plugin;
|
libdecor_plugin_gtk_frame_popup_grab(0, frame, seat_name);
|
||||||
|
|
||||||
plugin->priv->iface->frame_popup_grab(plugin, frame, seat_name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
libdecor_frame_popup_ungrab(struct libdecor_frame *frame,
|
libdecor_frame_popup_ungrab(struct libdecor_frame *frame, const char *seat_name){
|
||||||
const char *seat_name)
|
|
||||||
{
|
|
||||||
struct libdecor_frame_private *frame_priv = frame->priv;
|
struct libdecor_frame_private *frame_priv = frame->priv;
|
||||||
struct libdecor_plugin *plugin = ctx.plugin;
|
libdecor_plugin_gtk_frame_popup_ungrab(0, frame, seat_name);
|
||||||
|
|
||||||
plugin->priv->iface->frame_popup_ungrab(plugin, frame, seat_name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -1461,15 +1429,13 @@ libdecor_frame_translate_coordinate(struct libdecor_frame *frame,
|
||||||
int *frame_y)
|
int *frame_y)
|
||||||
{
|
{
|
||||||
struct libdecor_frame_private *frame_priv = frame->priv;
|
struct libdecor_frame_private *frame_priv = frame->priv;
|
||||||
struct libdecor_plugin *plugin = ctx.plugin;
|
|
||||||
|
|
||||||
*frame_x = content_x;
|
*frame_x = content_x;
|
||||||
*frame_y = content_y;
|
*frame_y = content_y;
|
||||||
|
|
||||||
if (frame_has_visible_client_side_decoration(frame) &&
|
if (frame_has_visible_client_side_decoration(frame)){
|
||||||
plugin->priv->iface->frame_get_border_size) {
|
|
||||||
int left, top;
|
int left, top;
|
||||||
plugin->priv->iface->frame_get_border_size(plugin, frame, NULL,
|
libdecor_plugin_gtk_frame_get_border_size(0, frame, NULL,
|
||||||
&left, NULL, &top, NULL);
|
&left, NULL, &top, NULL);
|
||||||
*frame_x += left;
|
*frame_x += left;
|
||||||
*frame_y += top;
|
*frame_y += top;
|
||||||
|
|
@ -1729,7 +1695,6 @@ libdecor_frame_commit(struct libdecor_frame *frame,
|
||||||
struct libdecor_configuration *configuration)
|
struct libdecor_configuration *configuration)
|
||||||
{
|
{
|
||||||
struct libdecor_frame_private *frame_priv = frame->priv;
|
struct libdecor_frame_private *frame_priv = frame->priv;
|
||||||
struct libdecor_plugin *plugin = ctx.plugin;
|
|
||||||
|
|
||||||
if (configuration && configuration->has_window_state) {
|
if (configuration && configuration->has_window_state) {
|
||||||
frame_priv->window_state = configuration->window_state;
|
frame_priv->window_state = configuration->window_state;
|
||||||
|
|
@ -1742,10 +1707,10 @@ libdecor_frame_commit(struct libdecor_frame *frame,
|
||||||
|
|
||||||
/* switch between decoration modes */
|
/* switch between decoration modes */
|
||||||
if (frame_has_visible_client_side_decoration(frame)) {
|
if (frame_has_visible_client_side_decoration(frame)) {
|
||||||
plugin->priv->iface->frame_commit(plugin, frame, state,
|
libdecor_plugin_gtk_frame_commit(0, frame, state,
|
||||||
configuration);
|
configuration);
|
||||||
} else {
|
} else {
|
||||||
plugin->priv->iface->frame_free(plugin, frame);
|
libdecor_plugin_gtk_frame_free(0, frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
frame_set_window_geometry(frame,
|
frame_set_window_geometry(frame,
|
||||||
|
|
@ -1834,25 +1799,6 @@ libdecor_frame_get_wm_capabilities(struct libdecor_frame *frame)
|
||||||
return frame_priv->wm_capabilities;
|
return frame_priv->wm_capabilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
libdecor_plugin_init(struct libdecor_plugin *plugin,
|
|
||||||
struct libdecor_plugin_interface *iface)
|
|
||||||
{
|
|
||||||
plugin->priv = calloc(1, sizeof (struct libdecor_plugin_private));
|
|
||||||
if (!plugin->priv)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
plugin->priv->iface = iface;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
libdecor_plugin_release(struct libdecor_plugin *plugin)
|
|
||||||
{
|
|
||||||
free(plugin->priv);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xdg_wm_base_ping(void *user_data,
|
xdg_wm_base_ping(void *user_data,
|
||||||
struct xdg_wm_base *xdg_wm_base,
|
struct xdg_wm_base *xdg_wm_base,
|
||||||
|
|
@ -1870,7 +1816,7 @@ notify_error(enum libdecor_error error, const char *message)
|
||||||
{
|
{
|
||||||
ctx.has_error = true;
|
ctx.has_error = true;
|
||||||
libdecorevent__error(error, message);
|
libdecorevent__error(error, message);
|
||||||
ctx.plugin->priv->iface->destroy(ctx.plugin);
|
libdecor_plugin_gtk_destroy(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -1884,8 +1830,7 @@ finish_init(void){
|
||||||
int
|
int
|
||||||
libdecor_dispatch(int timeout)
|
libdecor_dispatch(int timeout)
|
||||||
{
|
{
|
||||||
struct libdecor_plugin *plugin = ctx.plugin;
|
return libdecor_plugin_gtk_dispatch(0, timeout);
|
||||||
return plugin->priv->iface->dispatch(plugin, timeout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -1923,9 +1868,7 @@ libdecor_notify_plugin_error(enum libdecor_error error,
|
||||||
|
|
||||||
void
|
void
|
||||||
cleanup(void){
|
cleanup(void){
|
||||||
if (ctx.plugin != 0){
|
libdecor_plugin_gtk_destroy(0);
|
||||||
ctx.plugin->priv->iface->destroy(ctx.plugin);
|
|
||||||
}
|
|
||||||
if (ctx.wl_subcompositor != 0){
|
if (ctx.wl_subcompositor != 0){
|
||||||
wl_subcompositor_destroy(ctx.wl_subcompositor);
|
wl_subcompositor_destroy(ctx.wl_subcompositor);
|
||||||
}
|
}
|
||||||
|
|
@ -1943,10 +1886,7 @@ cleanup(void){
|
||||||
//#include "libdecor-fallback.c"
|
//#include "libdecor-fallback.c"
|
||||||
static void
|
static void
|
||||||
libdecor_plugin_fallback_destroy(struct libdecor_plugin *plugin)
|
libdecor_plugin_fallback_destroy(struct libdecor_plugin *plugin)
|
||||||
{
|
{}
|
||||||
libdecor_plugin_release(plugin);
|
|
||||||
free(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
libdecor_plugin_fallback_get_fd(struct libdecor_plugin *plugin)
|
libdecor_plugin_fallback_get_fd(struct libdecor_plugin *plugin)
|
||||||
|
|
@ -2090,7 +2030,6 @@ libdecor_fallback_plugin_new(void){
|
||||||
struct libdecor_plugin_fallback *plugin;
|
struct libdecor_plugin_fallback *plugin;
|
||||||
|
|
||||||
plugin = calloc(1, sizeof *plugin);
|
plugin = calloc(1, sizeof *plugin);
|
||||||
libdecor_plugin_init(&plugin->plugin, &fallback_plugin_iface);
|
|
||||||
plugin->context = 0;
|
plugin->context = 0;
|
||||||
|
|
||||||
libdecor_notify_plugin_ready();
|
libdecor_notify_plugin_ready();
|
||||||
|
|
@ -2624,8 +2563,6 @@ update_local_cursor(struct seat *seat);
|
||||||
static void
|
static void
|
||||||
libdecor_plugin_gtk_destroy(struct libdecor_plugin *plugin)
|
libdecor_plugin_gtk_destroy(struct libdecor_plugin *plugin)
|
||||||
{
|
{
|
||||||
struct libdecor_plugin_gtk *plugin_gtk =
|
|
||||||
(struct libdecor_plugin_gtk *) plugin;
|
|
||||||
struct seat *seat, *seat_tmp;
|
struct seat *seat, *seat_tmp;
|
||||||
struct output *output, *output_tmp;
|
struct output *output, *output_tmp;
|
||||||
struct libdecor_frame_gtk *frame, *frame_tmp;
|
struct libdecor_frame_gtk *frame, *frame_tmp;
|
||||||
|
|
@ -2667,23 +2604,19 @@ libdecor_plugin_gtk_destroy(struct libdecor_plugin *plugin)
|
||||||
wl_list_remove(&frame->link);
|
wl_list_remove(&frame->link);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx.wl_shm)
|
if (ctx.wl_shm){
|
||||||
wl_shm_destroy(ctx.wl_shm);
|
wl_shm_destroy(ctx.wl_shm);
|
||||||
|
}
|
||||||
libdecor_plugin_release(&plugin_gtk->plugin);
|
|
||||||
free(plugin_gtk);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct libdecor_frame_gtk *
|
static struct libdecor_frame_gtk *
|
||||||
libdecor_frame_gtk_new(struct libdecor_plugin_gtk *plugin_gtk)
|
libdecor_frame_gtk_new(void){
|
||||||
{
|
|
||||||
struct libdecor_frame_gtk *frame_gtk = calloc(1, sizeof *frame_gtk);
|
struct libdecor_frame_gtk *frame_gtk = calloc(1, sizeof *frame_gtk);
|
||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
|
|
||||||
static const int size = 128;
|
static const int size = 128;
|
||||||
static const int boundary = 32;
|
static const int boundary = 32;
|
||||||
|
|
||||||
frame_gtk->plugin_gtk = plugin_gtk;
|
|
||||||
frame_gtk->shadow_blur = cairo_image_surface_create(
|
frame_gtk->shadow_blur = cairo_image_surface_create(
|
||||||
CAIRO_FORMAT_ARGB32, size, size);
|
CAIRO_FORMAT_ARGB32, size, size);
|
||||||
wl_list_insert(&ctx.visible_frame_list, &frame_gtk->link);
|
wl_list_insert(&ctx.visible_frame_list, &frame_gtk->link);
|
||||||
|
|
@ -2712,8 +2645,7 @@ libdecor_plugin_gtk_get_fd(struct libdecor_plugin *plugin)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
libdecor_plugin_gtk_dispatch(struct libdecor_plugin *plugin,
|
libdecor_plugin_gtk_dispatch(struct libdecor_plugin *plugin, int timeout)
|
||||||
int timeout)
|
|
||||||
{
|
{
|
||||||
struct libdecor_plugin_gtk *plugin_gtk =
|
struct libdecor_plugin_gtk *plugin_gtk =
|
||||||
(struct libdecor_plugin_gtk *) plugin;
|
(struct libdecor_plugin_gtk *) plugin;
|
||||||
|
|
@ -2768,7 +2700,7 @@ libdecor_plugin_gtk_frame_new(struct libdecor_plugin *plugin)
|
||||||
(struct libdecor_plugin_gtk *) plugin;
|
(struct libdecor_plugin_gtk *) plugin;
|
||||||
struct libdecor_frame_gtk *frame_gtk;
|
struct libdecor_frame_gtk *frame_gtk;
|
||||||
|
|
||||||
frame_gtk = libdecor_frame_gtk_new(plugin_gtk);
|
frame_gtk = libdecor_frame_gtk_new();
|
||||||
|
|
||||||
return &frame_gtk->frame;
|
return &frame_gtk->frame;
|
||||||
}
|
}
|
||||||
|
|
@ -2802,6 +2734,7 @@ const struct wl_buffer_listener buffer_listener = {
|
||||||
buffer_release
|
buffer_release
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct libdecor_plugin_gtk;
|
||||||
static struct buffer *
|
static struct buffer *
|
||||||
create_shm_buffer(struct libdecor_plugin_gtk *plugin_gtk,
|
create_shm_buffer(struct libdecor_plugin_gtk *plugin_gtk,
|
||||||
int width,
|
int width,
|
||||||
|
|
@ -3011,8 +2944,7 @@ surface_enter(void *data,
|
||||||
if (cmpnt == NULL)
|
if (cmpnt == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!add_surface_output(frame_gtk->plugin_gtk, wl_output,
|
if (!add_surface_output(0, wl_output, &cmpnt->output_list))
|
||||||
&cmpnt->output_list))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (redraw_scale(frame_gtk, cmpnt))
|
if (redraw_scale(frame_gtk, cmpnt))
|
||||||
|
|
@ -3065,7 +2997,6 @@ create_surface_subsurface_pair(struct libdecor_frame_gtk *frame_gtk,
|
||||||
struct wl_surface **out_wl_surface,
|
struct wl_surface **out_wl_surface,
|
||||||
struct wl_subsurface **out_wl_subsurface)
|
struct wl_subsurface **out_wl_subsurface)
|
||||||
{
|
{
|
||||||
struct libdecor_plugin_gtk *plugin_gtk = frame_gtk->plugin_gtk;
|
|
||||||
struct libdecor_frame *frame = &frame_gtk->frame;
|
struct libdecor_frame *frame = &frame_gtk->frame;
|
||||||
struct wl_compositor *wl_compositor = ctx.wl_compositor;
|
struct wl_compositor *wl_compositor = ctx.wl_compositor;
|
||||||
struct wl_surface *wl_surface;
|
struct wl_surface *wl_surface;
|
||||||
|
|
@ -3531,7 +3462,6 @@ draw_border_component(struct libdecor_frame_gtk *frame_gtk,
|
||||||
struct border_component *border_component,
|
struct border_component *border_component,
|
||||||
enum component component)
|
enum component component)
|
||||||
{
|
{
|
||||||
struct libdecor_plugin_gtk *plugin_gtk = frame_gtk->plugin_gtk;
|
|
||||||
struct buffer *old_buffer;
|
struct buffer *old_buffer;
|
||||||
struct buffer *buffer = NULL;
|
struct buffer *buffer = NULL;
|
||||||
int component_x;
|
int component_x;
|
||||||
|
|
@ -3562,7 +3492,7 @@ draw_border_component(struct libdecor_frame_gtk *frame_gtk,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
buffer = create_shm_buffer(plugin_gtk,
|
buffer = create_shm_buffer(0,
|
||||||
component_width,
|
component_width,
|
||||||
component_height,
|
component_height,
|
||||||
border_component->opaque,
|
border_component->opaque,
|
||||||
|
|
@ -3901,7 +3831,6 @@ libdecor_plugin_gtk_frame_popup_grab(struct libdecor_plugin *plugin,
|
||||||
{
|
{
|
||||||
struct libdecor_frame_gtk *frame_gtk =
|
struct libdecor_frame_gtk *frame_gtk =
|
||||||
(struct libdecor_frame_gtk *) frame;
|
(struct libdecor_frame_gtk *) frame;
|
||||||
struct libdecor_plugin_gtk *plugin_gtk = frame_gtk->plugin_gtk;
|
|
||||||
struct seat *seat;
|
struct seat *seat;
|
||||||
|
|
||||||
wl_list_for_each(seat, &ctx.seat_list, link) {
|
wl_list_for_each(seat, &ctx.seat_list, link) {
|
||||||
|
|
@ -3927,7 +3856,6 @@ libdecor_plugin_gtk_frame_popup_ungrab(struct libdecor_plugin *plugin,
|
||||||
{
|
{
|
||||||
struct libdecor_frame_gtk *frame_gtk =
|
struct libdecor_frame_gtk *frame_gtk =
|
||||||
(struct libdecor_frame_gtk *) frame;
|
(struct libdecor_frame_gtk *) frame;
|
||||||
struct libdecor_plugin_gtk *plugin_gtk = frame_gtk->plugin_gtk;
|
|
||||||
struct seat *seat;
|
struct seat *seat;
|
||||||
|
|
||||||
wl_list_for_each(seat, &ctx.seat_list, link) {
|
wl_list_for_each(seat, &ctx.seat_list, link) {
|
||||||
|
|
@ -4073,7 +4001,6 @@ ensure_cursor_surface(struct seat *seat)
|
||||||
static bool
|
static bool
|
||||||
ensure_cursor_theme(struct seat *seat)
|
ensure_cursor_theme(struct seat *seat)
|
||||||
{
|
{
|
||||||
struct libdecor_plugin_gtk *plugin_gtk = seat->plugin_gtk;
|
|
||||||
int scale = 1;
|
int scale = 1;
|
||||||
struct wl_cursor_theme *theme;
|
struct wl_cursor_theme *theme;
|
||||||
struct cursor_output *cursor_output;
|
struct cursor_output *cursor_output;
|
||||||
|
|
@ -4226,8 +4153,6 @@ pointer_enter(void *data,
|
||||||
|
|
||||||
if (!own_surface(surface)) {
|
if (!own_surface(surface)) {
|
||||||
struct seat *seat = wl_pointer_get_user_data(wl_pointer);
|
struct seat *seat = wl_pointer_get_user_data(wl_pointer);
|
||||||
struct libdecor_plugin_gtk *plugin_gtk = seat->plugin_gtk;
|
|
||||||
|
|
||||||
if (!ctx.handle_cursor)
|
if (!ctx.handle_cursor)
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -307,8 +307,6 @@ enum component {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct seat {
|
struct seat {
|
||||||
struct libdecor_plugin_gtk *plugin_gtk;
|
|
||||||
|
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
struct wl_seat *wl_seat;
|
struct wl_seat *wl_seat;
|
||||||
|
|
@ -340,8 +338,6 @@ struct seat {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct output {
|
struct output {
|
||||||
struct libdecor_plugin_gtk *plugin_gtk;
|
|
||||||
|
|
||||||
struct wl_output *wl_output;
|
struct wl_output *wl_output;
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
int scale;
|
int scale;
|
||||||
|
|
@ -389,8 +385,6 @@ struct cursor_output {
|
||||||
struct libdecor_frame_gtk {
|
struct libdecor_frame_gtk {
|
||||||
struct libdecor_frame frame;
|
struct libdecor_frame frame;
|
||||||
|
|
||||||
struct libdecor_plugin_gtk *plugin_gtk;
|
|
||||||
|
|
||||||
int content_width;
|
int content_width;
|
||||||
int content_height;
|
int content_height;
|
||||||
|
|
||||||
|
|
@ -432,10 +426,6 @@ struct libdecor_frame_gtk {
|
||||||
} titlebar_gesture;
|
} titlebar_gesture;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct libdecor_plugin_gtk {
|
|
||||||
struct libdecor_plugin plugin;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum titlebar_gesture {
|
enum titlebar_gesture {
|
||||||
TITLEBAR_GESTURE_DOUBLE_CLICK,
|
TITLEBAR_GESTURE_DOUBLE_CLICK,
|
||||||
TITLEBAR_GESTURE_MIDDLE_CLICK,
|
TITLEBAR_GESTURE_MIDDLE_CLICK,
|
||||||
|
|
@ -553,8 +543,6 @@ int libdecor_state_get_content_height(struct libdecor_state *state);
|
||||||
|
|
||||||
enum libdecor_window_state libdecor_state_get_window_state(struct libdecor_state *state);
|
enum libdecor_window_state libdecor_state_get_window_state(struct libdecor_state *state);
|
||||||
|
|
||||||
int libdecor_plugin_init(struct libdecor_plugin *plugin, struct libdecor_plugin_interface *iface);
|
|
||||||
|
|
||||||
void libdecor_plugin_release(struct libdecor_plugin *plugin);
|
void libdecor_plugin_release(struct libdecor_plugin *plugin);
|
||||||
|
|
||||||
// #include "libdecor-fallback.h"
|
// #include "libdecor-fallback.h"
|
||||||
|
|
@ -592,6 +580,20 @@ static void output_removed(struct output *output);
|
||||||
|
|
||||||
static const char *libdecor_gtk_proxy_tag = "libdecor-gtk";
|
static const char *libdecor_gtk_proxy_tag = "libdecor-gtk";
|
||||||
|
|
||||||
|
static void libdecor_plugin_gtk_destroy(struct libdecor_plugin *plugin);
|
||||||
|
static int libdecor_plugin_gtk_get_fd(struct libdecor_plugin *plugin);
|
||||||
|
static int libdecor_plugin_gtk_get_fd(struct libdecor_plugin *plugin);
|
||||||
|
static int libdecor_plugin_gtk_dispatch(struct libdecor_plugin *plugin, int timeout);
|
||||||
|
static void libdecor_plugin_gtk_set_handle_application_cursor(struct libdecor_plugin *plugin, bool handle_cursor);
|
||||||
|
static struct libdecor_frame * libdecor_plugin_gtk_frame_new(struct libdecor_plugin *plugin);
|
||||||
|
static void libdecor_plugin_gtk_frame_free(struct libdecor_plugin *plugin, struct libdecor_frame *frame);
|
||||||
|
static void libdecor_plugin_gtk_frame_commit(struct libdecor_plugin *plugin, struct libdecor_frame *frame, struct libdecor_state *state, struct libdecor_configuration *configuration);
|
||||||
|
static void libdecor_plugin_gtk_frame_property_changed(struct libdecor_plugin *plugin, struct libdecor_frame *frame);
|
||||||
|
static void libdecor_plugin_gtk_frame_popup_grab(struct libdecor_plugin *plugin, struct libdecor_frame *frame, const char *seat_name);
|
||||||
|
static void libdecor_plugin_gtk_frame_popup_ungrab(struct libdecor_plugin *plugin, struct libdecor_frame *frame, const char *seat_name);
|
||||||
|
static bool libdecor_plugin_gtk_frame_get_border_size(struct libdecor_plugin *plugin, struct libdecor_frame *frame, struct libdecor_configuration *configuration,
|
||||||
|
int *left, int *right, int *top, int *bottom);
|
||||||
|
|
||||||
// digesting_libdecor
|
// digesting_libdecor
|
||||||
|
|
||||||
typedef struct Ctx{
|
typedef struct Ctx{
|
||||||
|
|
@ -615,9 +617,6 @@ typedef struct Ctx{
|
||||||
struct wl_list seat_list;
|
struct wl_list seat_list;
|
||||||
struct wl_list output_list;
|
struct wl_list output_list;
|
||||||
|
|
||||||
struct libdecor_plugin_gtk *plugin_gtk;
|
|
||||||
struct libdecor_plugin *plugin;
|
|
||||||
|
|
||||||
bool plugin_ready;
|
bool plugin_ready;
|
||||||
bool init_done;
|
bool init_done;
|
||||||
bool has_error;
|
bool has_error;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue