DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2053
Version: 1.3-feature


If the user does not specifically set a Fl_Window's (or derivative thereof)
xclass(const char*), then it is possible that that instance will not have a
xclass. This causes problems for window managers that rely on the xclass
(in X its WM_CLASS property) to perform special operations (e.g. Compiz
animations, tiling window managers, etc.)

This issue has been discussed in fltk.development.

The attach patch adds a private static const *default_xclass_ to
Fl_Window. When Fl_Window::xclass(const char *c) is called, and
default_xclass_ is NULL, a copy of c is stored in default_xclass_. When
Fl_Window::xclass() is called, either the local member, xclass_, is
returned, or, if xclass_ is NULL, default_xclass is returned.

The effectively ensures that every time that Fl_Window::xclass() is
called, a valid string is returned.

>From what I can tell, by reading FLTK's source, is that when
Fl_Window::show(int,char**) is called, Fl_Window::xclass() is examined. If
Fl_Window::xclass() returns NULL, a string is constructed out of argv[0]
(See Fl_Window::show(int,char**) in Fl_arg.cxx).

In the case of X, when Fl_Window::show() is used to create a window,
Fl::make_xid() is called. Fl::make_xid() will then examine
Fl_Window::xclass() and use it accordingly. Prior to the attached patch,
if Fl_Window::xclass() returns NULL, then the window's WM_CLASS property
will not be set. This patch will ensure that this does not happen.

I am not sure what happens when Fl_Window::show() is called for the other
operating systems. This patch should be tested by those who have access to
those operating systems.

If Fl_Window::show() is used to spawn the first window of the application
and xclass is not set (e.g. X class field in fluid is empty or
Fl_Window::xclass(const char*) has not be called first), then, I believe,
the window will not have a class property. This needs to be tested.

I have also attached a small applciation that spawns a Fl_Double_Window
that contains a Fl_Box and a Fl_Button. When the window is shown, the
xclass string is used as the Fl_Box's label. Each time the button is
pressed, a new instance of the window is shown and the result of xclass is
displayed. Prior to this patch, each new window spawned would have "null"
displayed. With this patch, each new window inherits the xclass() of the
first window shown in this application (i.e. in X, the string "xclass() =
xclass_test" is shown).

I have also tested this by setting a Compiz animation for FLUID. As a
result, every window created by fluid now has the Sidekick animation
occur.

To compile the test app:
fluid -c xclass_test.fl
fltk-config --compile xclass_test.cxx


Link: http://www.fltk.org/str.php?L2053
Version: 1.3-feature

Attachment: xclass_test.fl
Description: Binary data

_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to