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

Missing XDG decoration results in missing window system controls #2212

Closed
Demonese opened this issue Oct 31, 2022 · 3 comments
Closed

Missing XDG decoration results in missing window system controls #2212

Demonese opened this issue Oct 31, 2022 · 3 comments
Labels
enhancement Feature suggestions and PRs Wayland
Milestone

Comments

@Demonese
Copy link

Demonese commented Oct 31, 2022

System:

  • OS Ubuntu 22.04.1 LTS
  • GNOME 42.4
  • Window System Wayland

Code

#include <assert.h>
#include <stdio.h>
#include "glad/gl.h"
#include <GLFW/glfw3.h>

void error_callback(int code, const char* description)
{
    printf("[E] [glfw] (code=%d) %s\n", code, description);
}

int main()
{
    GLFWwindow* window = NULL;

    glfwSetErrorCallback(error_callback);

    /* Initialize the library */
    if (!glfwInit())
        return -1;

    //glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

    /* Create a windowed mode window and its OpenGL context */
    
    window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
    if (!window)
    {
        glfwTerminate();
        return -1;
    }

    glfwMakeContextCurrent(window);

    if (!gladLoadGL((GLADloadfunc)glfwGetProcAddress))
    {
        printf("[E] [glad] gladLoadGL failed\n");
        return -1;
    }
    printf("[I] [gl]\n    Vendor: %s\n    Renderer: %s\n    Version: %s\n",
        glGetString(GL_VENDOR), glGetString(GL_RENDERER), glGetString(GL_VERSION));

    glfwShowWindow(window);

    /* Loop until the user closes the window */
    int tick = 0;
    while (!glfwWindowShouldClose(window))
    {
        /* Poll for and process events */
        glfwPollEvents();

        //printf("[I] update: %d\n", tick);
        tick += 1;

        glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
        glClear(GL_COLOR_BUFFER_BIT);

        glfwSwapInterval(1);
        glfwSwapBuffers(window);
    }
    
    glfwDestroyWindow(window);
    glfwTerminate();
    return 0;
}

ScreenShot:
image

Wayland Global:

[I] [wayland] global wl_compositor (v5)
[I] [wayland] global wl_drm (v2)
[I] [wayland] global wl_shm (v1)
[I] [wayland] global wl_output (v2)
[I] [wayland] global zxdg_output_manager_v1 (v3)
[I] [wayland] global wl_data_device_manager (v3)
[I] [wayland] global zwp_primary_selection_device_manager_v1 (v1)
[I] [wayland] global gtk_primary_selection_device_manager (v1)
[I] [wayland] global wl_subcompositor (v1)
[I] [wayland] global xdg_wm_base (v4)
[I] [wayland] global zxdg_shell_v6 (v1)
[I] [wayland] global gtk_shell1 (v5)
[I] [wayland] global wp_viewporter (v1)
[I] [wayland] global zwp_pointer_gestures_v1 (v3)
[I] [wayland] global zwp_tablet_manager_v2 (v1)
[I] [wayland] global wl_seat (v5)
[I] [wayland] global zwp_relative_pointer_manager_v1 (v1)
[I] [wayland] global zwp_pointer_constraints_v1 (v1)
[I] [wayland] global zxdg_exporter_v1 (v1)
[I] [wayland] global zxdg_importer_v1 (v1)
[I] [wayland] global zwp_linux_dmabuf_v1 (v4)
[I] [wayland] global zwp_keyboard_shortcuts_inhibit_manager_v1 (v1)
[I] [wayland] global zwp_text_input_manager_v3 (v1)
[I] [wayland] global wp_presentation (v1)
[I] [wayland] global xdg_activation_v1 (v1)
@sauron65
Copy link

sauron65 commented Nov 23, 2022

@gracicot
Copy link
Contributor

Yes. Libdecor is the solution for decorations in Wayland. The library is lightweight and uses native decorations on GNOME, plasma and wlroots based compositors. It uses either xdg-decoration protocol if available or draw the decoration if required.

@elmindreda elmindreda changed the title [Wayland] Missing XDG decoration results in missing window system controls Missing XDG decoration results in missing window system controls Jan 31, 2024
@elmindreda elmindreda added enhancement Feature suggestions and PRs Wayland labels Jan 31, 2024
@elmindreda
Copy link
Member

Support for libdecor has now been added with #2285 and was included in the latest stable release.

@elmindreda elmindreda added this to the 3.3.9 milestone Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature suggestions and PRs Wayland
Projects
None yet
Development

No branches or pull requests

4 participants