After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 145131 - No titlebar on windows without WM_NORMAL_HINTS (random)
No titlebar on windows without WM_NORMAL_HINTS (random)
Status: RESOLVED FIXED
Product: metacity
Classification: Other
Component: general
trunk
Other Linux
: High major
: 2.10.x
Assigned To: Metacity maintainers list
Metacity maintainers list
: 133584 166205 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-06-29 11:07 UTC by Sinisa Segvic
Modified: 2005-02-05 03:04 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10


Attachments
Portion of the valgrind log relevant to the window appearing from Owen's testcase (17.40 KB, text/plain)
2005-02-03 22:56 UTC, Elijah Newren
  Details
Initialize window->border_only (823 bytes, patch)
2005-02-04 00:59 UTC, Elijah Newren
none Details | Review
Alternate way to initialize window->border_only (525 bytes, patch)
2005-02-04 02:07 UTC, Elijah Newren
accepted-commit_now Details | Review

Description Sinisa Segvic 2004-06-29 11:07:19 UTC
Description of Problem:

When multiple windows are created, wm sometimes
forgets to decorate some of the created windows
window with a caption.
The window otherwise does fine, and can be dragged
with alt+left click.


Steps to reproduce the problem:

Version:  metacity 2.8.1-3 (Debian Sarge)

=========================================
== captionbug.c begin

#include <X11/Xlib.h>
#include <stdio.h>
// gcc captionbug.c  -lX11 -L/usr/X11R6/lib

main(){
  int i;
  XEvent ev;
  
  Display *dpy= XOpenDisplay(0);
  int screen=XDefaultScreen(dpy);
  for (i=0; i<5; ++i){
    Window wnd=XCreateSimpleWindow(
      dpy, DefaultRootWindow(dpy),
      0, 0, 320, 240, 0,
      BlackPixel(dpy, screen),
      WhitePixel(dpy, screen));
    XSelectInput(
      dpy, wnd,
      StructureNotifyMask | KeyPressMask |
      ExposureMask        | ButtonPressMask);
    XMapWindow(dpy, wnd);
  }
  while (1){  
    XNextEvent(dpy, &ev);
  }
}

== captionbug.c end
=========================================


Actual Results:

There is no regular pattern, sometimes all
captions are there, sometimes 2-3 captions miss.


Expected Results:

I would expect all captions to be there.


How often does this happen? 

The problem always showed at least after 5
invocations of the test program.



Additional Information:

The program does fine on metacity 2.4.55 (Suse9).
Comment 1 Sinisa Segvic 2004-07-12 13:31:37 UTC
I forgot to metion that both testing machines have dual CPUs...
Comment 2 Elijah Newren 2005-01-24 22:46:36 UTC
Sorry for the slow response, but thanks for the awesome test case.  Maybe now we
can track down the bug reports we've gotten about undecorated windows appearing.

I can confirm this--with the given program, I occasionally get one of the
windows to be undecorated...
Comment 3 Sinisa Segvic 2005-01-25 08:56:03 UTC
Besides with my application, the same problem arises when starting OpenOffice
and acroread. Other programs always have the caption in place.

Besides at debian sarge (2xXeon), the problem also arises at MacOS X 
(2xPowerPC), but never at Suse 9.0 (2xOpteron).
Comment 4 Elijah Newren 2005-01-25 16:05:26 UTC
Bug 133584 is probably a duplicate.  So it appears we have duplicates with
links2/glinks (from bug 138661 which is a dupe of 133584) and acroread as well.

I only had a few minutes to look at this, but running metacity under valgrind
appears to give some uninitialized variable warnings when this test program is
run.  Hopefully I can track those down and one of those turns out to be the
problem...
Comment 5 Elijah Newren 2005-01-26 16:55:58 UTC
*** Bug 133584 has been marked as a duplicate of this bug. ***
Comment 6 Elijah Newren 2005-02-03 20:22:40 UTC
*** Bug 166205 has been marked as a duplicate of this bug. ***
Comment 7 Elijah Newren 2005-02-03 20:24:31 UTC
Owen pointed out that this is related to WM_NORMAL_HINTS.  He also provides
another testcase we can use.

Although I have no clue whether I'll be able to solve this by 2.10, I'm going to
throw it on that milestone anyway.
Comment 8 Elijah Newren 2005-02-03 22:56:58 UTC
Created attachment 36952 [details]
Portion of the valgrind log relevant to the window appearing from Owen's testcase
Comment 9 Elijah Newren 2005-02-04 00:59:46 UTC
Created attachment 36955 [details] [review]
Initialize window->border_only

So, I believe this could have happened with just about any window, because we
only ever set window->border_only in recalc_window_features().	Since it's an
uninitialized variable thing, it probably just depended on what was in the
heap/stack so we were just lucky that they test cases seem to be likely to set
memory up just right.

It also explains why, in one of the bug reports, the user says they were able
to get the border back by interacting with the window.	(I just tried it out,
and yes, maximizing windows like these without a border via keybindings will
return the border)
Comment 10 Elijah Newren 2005-02-04 02:07:02 UTC
Created attachment 36959 [details] [review]
Alternate way to initialize window->border_only

Oops, spoke too soon.  :-}  window->border_only would be initialized for all
windows except those that didn't set MWM hints--I missed the
recalc_window_features() call at the end of update_mwm_hints().  So, this patch
just makes sure that recalc_window_features() is called before any exit from
update_mwm_hints(), which I think is a cleaner fix.
Comment 11 Havoc Pennington 2005-02-05 02:50:25 UTC
Comment on attachment 36959 [details] [review]
Alternate way to initialize window->border_only

Thanks, good catch. This one may be worth putting in 2.8 also?
Comment 12 Elijah Newren 2005-02-05 03:04:43 UTC
Committed to HEAD and gnome-2-8.

2005-02-04  Elijah Newren  <newren@gmail.com>

	Make sure window->border_only is initialized so we don't get
	random windows without decorations.  Thanks to Sinisa Segvic and
	Owen Taylor for providing test cases.  Fixes #145131.

	* src/window.c: (update_mwm_hints): Be sure to call
	recalc_window_features even if no MWM hints are set