Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 991369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:05:53+00:00 2026-05-16T06:05:53+00:00

Context: I use glfw under xmonad. Glfw apparently sets the window title after creating

  • 0

Context:

I use glfw under xmonad. Glfw apparently sets the window title after creating the window, thus not allowing xmonad to properly handle it. I want to modify the glfw source so that I can set the window title before creating the window.

Problem:

So I download glfw-2.6, and I look into lib/x11/x11_window.c ; the lines causing the trouble are:

// Create a window
_glfwWin.Win = XCreateWindow(
    _glfwLibrary.Dpy,
    RootWindow( _glfwLibrary.Dpy, _glfwWin.VI->screen ),
    0, 0,                            // Upper left corner
    _glfwWin.Width, _glfwWin.Height, // Width, height
    0,                               // Borderwidth
    _glfwWin.VI->depth,              // Depth
    InputOutput,
    _glfwWin.VI->visual,
    CWBorderPixel | CWColormap | CWEventMask,
    &wa
);

Followed sometime later by:

_glfwPlatformSetWindowTitle( "GLFW Window" );

where

void _glfwPlatformSetWindowTitle( const char *title )
{
    // Set window & icon title
    XStoreName( _glfwLibrary.Dpy, _glfwWin.Win, title );
    XSetIconName( _glfwLibrary.Dpy, _glfwWin.Win, title );
}

Now, if I tr yto move the glfwPlatformSetWindowTitle call before the CreateWindow call, I get a segfault — as I should, since _glfwWin.win would not be defined.

I don’t know how to solve this problem since to set the window title, I need _glfwWin.Win to be initialized, but to initialize it, I need to create the window.

Thus, I ask: in X11, what is the proper way to set the window title before creating the window?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:05:53+00:00Added an answer on May 16, 2026 at 6:05 am

    This is not possible in X11, but also not necessary for stuff to work. There must be a bug somewhere causing the symptoms you’re seeing. The window title is just a property on the window, and properties can’t exist until there’s a window for them to be on.

    You say “not allowing xmonad to properly handle it” which implies it isn’t coping with changes to the name; window managers absolutely must handle setting the title at any time, including changing the title long after a window is created.

    What the spec says (http://www.x.org/docs/ICCCM/icccm.pdf) is:
    “The window manager will examine the contents of these properties when the window makes the
    transition from the Withdrawn state and will monitor some properties for changes while the window is in the Iconic or Normal state.”

    The “transition from the Withdrawn state” is the point where glfw calls XMapWindow(). At that point, the window will remain unmapped but the WM will receive a MapRequest. The WM would then read properties and such and then map the window. All window managers I’ve ever seen also handle later changes to the property because changing the window title is pretty normal. For example web browsers the page title on every url.

    If xmonad doesn’t handle changes maybe it at least waits for the map, so maybe you just need to set title before XMapWindow(). Really all setup should be done before MapWindow though only a few properties are required to be before it by the specs. The props that must be before it generally can’t be changed without unmapping.

    Incidentally, _glfwPlatformSetWindowTitle won’t work for anything but Latin-1. The modern way to do it is to set _NET_WM_NAME and _NET_WM_ICON_NAME with XChangeProperty() (setting the old Latin-1 WM_NAME is fine too but only as a fallback).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.