diff --git a/wayland_libdecor_egl.c b/wayland_libdecor_egl.c index 1bde13f..a3b51d4 100755 --- a/wayland_libdecor_egl.c +++ b/wayland_libdecor_egl.c @@ -7,12 +7,10 @@ exit 0 /* ** Reading From: ** (1) Wayland Docs https://wayland.freedesktop.org/docs/html/ -** (2) XDG shell Docs https://wayland.app/protocols/xdg-shell#xdg_wm_base ** (egl) EGL spec https://registry.khronos.org/EGL/sdk/docs/man/ -** +** (libdecor.h) /usr/include/libdecor-0/libdecor.h +** ** (nodocs-wl_egl) I cannot find any documentation for wl_egl_ except for - ** headers and example code. -** (nodocs-libdecor) not officially documented, deductions from reading ** headers and example code. */ @@ -96,7 +94,7 @@ const struct wl_registry_listener wl_registry_listener = { }; -/* (nodocs) */ +/* (libdecor.h) libdecor_interface::error " An error event " */ static void libdecorevent__error(struct libdecor *libdecor, enum libdecor_error error, const char *msg){} @@ -108,8 +106,8 @@ struct libdecor_interface libdecor_interface = { /* (libdecor.h) libdecor_frame_interface::configure ** " A new configuration was received. An application should respond to - ** this by creating a suitable libdecor_state, and apply it using - ** libdecor_frame_commit. " +** this by creating a suitable libdecor_state, and apply it using +** libdecor_frame_commit. " */ static void libdecorevent__frame_configure(struct libdecor_frame *frame, @@ -117,10 +115,12 @@ libdecorevent__frame_configure(struct libdecor_frame *frame, void *udata){ int w = ctx.w; int h = ctx.h; - /* (nodocs) */ + /* (libdecor.h) + ** " Get the expected size of the content for this configuration. " + */ if (libdecor_configuration_get_content_size(config, frame, &w, &h)){ - /* (nodocs) */ + /* (libdecor.h) " Create a new content surface state. " */ struct libdecor_state *state = libdecor_state_new(w, h); /* (libdecor.h) libdecor_frame_commit @@ -131,7 +131,7 @@ libdecorevent__frame_configure(struct libdecor_frame *frame, */ libdecor_frame_commit(frame, state, config); - /* (nodocs) */ + /* (libdecor.h) " Free a content surface state. " */ libdecor_state_free(state); } ctx.configured = 1; @@ -139,22 +139,41 @@ libdecorevent__frame_configure(struct libdecor_frame *frame, ctx.h = h; } -/* (nodocs) */ +/* (libdecor.h) libdecor_frame_interface::close +** " The window was requested to be closed by the compositor. " +*/ static void libdecorevent__frame_close(struct libdecor_frame *frame, void *udata){ ctx.close_signal = 1; } -/* (nodocs) */ +/* (libdecor.h) libdecor_frame_interface::commit +** " The window decoration asked to have the main surface to be +** committed. This is required when the decoration is implemented +** using synchronous subsurfaces. " +*/ static void libdecorevent__frame_commit(struct libdecor_frame *frame, void *udata){ wl_surface_commit(ctx.wl_surface); } +/* (libdecor.h) libdecor_frame_interface::dismiss_popup +** " Any mapped popup that has a grab on the given seat should be dismissed. " +*/ +static void +libdecorevent__frame_dismiss_popup(){ + +} + +/* (libdecor.h) libdecor_frame_interface::dismiss_popup +** " Any mapped popup that has a grab on the given seat should +** be dismissed. " +*/ struct libdecor_frame_interface libdecor_frame_interface = { libdecorevent__frame_configure, libdecorevent__frame_close, libdecorevent__frame_commit, + libdecorevent__frame_dismiss_popup, }; @@ -203,7 +222,7 @@ int main(){ } } - /* (nodocs) */ + /* (libdecor.h) " Create a new libdecor context for the given wl_display " */ if (ctx.wl_display != 0 && ctx.wl_compositor != 0){ ctx.libdecor = libdecor_new(ctx.wl_display, &libdecor_interface); } @@ -308,13 +327,13 @@ int main(){ } if (ctx.wl_surface != 0){ - /* (nodocs-libdecor) */ + /* (libdecor.h) " Decorate the given content wl_surface. " */ ctx.libdecor_frame = libdecor_decorate(ctx.libdecor, ctx.wl_surface, &libdecor_frame_interface, 0); } if (ctx.libdecor_frame != 0){ - /* (nodocs-libdecor) */ + /* (libdecor.h) " Set the title of the window. " */ libdecor_frame_set_title(ctx.libdecor_frame, "Example Window"); /* (libdecor.h) " This translates roughly to xdg_toplevel_set_min_size() " @@ -323,7 +342,7 @@ int main(){ */ libdecor_frame_set_min_content_size(ctx.libdecor_frame, 80, 60); - /* (nodocs-libdecor) */ + /* (libdecor.h) " Map the window. " */ libdecor_frame_map(ctx.libdecor_frame); /* (nodocs-wl_egl) */ @@ -398,25 +417,18 @@ int main(){ } } - /* (egl) eglSwapBuffers - **~ NOTE: swap before loop for libdecor_dispatch (nodocs-libdecor) - */ - EGLBoolean initial_swap_success = 0; - if (swap_interval_success){ - initial_swap_success = eglSwapBuffers(ctx.egl_display, ctx.egl_surface); - if (!initial_swap_success){ - printf("eglSwapBuffers failed\n"); - } - } - /*~ NOTE: Main loop */ int exit_loop = 0; - if (!initial_swap_success){ + if (!swap_interval_success){ exit_loop = 1; } for (;!exit_loop;){ - /* (nodocs-libdecor) */ - libdecor_dispatch(ctx.libdecor, -1); + /* (libdecor.h) + ** " Dispatch events. This function should be called when data is available on + ** the file descriptor returned by libdecor_get_fd(). If timeout is zero, this + ** function will never block. " + */ + libdecor_dispatch(ctx.libdecor, 0); if (ctx.close_signal){ exit_loop = 1;