Bug 94111 - Clean up has_foo_func and related macros so we understand them
Clean up has_foo_func and related macros so we understand them
Status: NEW
Product: metacity
Classification: Other
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: Metacity maintainers list
Metacity maintainers list
:
Depends on: 90420
Blocks: 155453 340682 93586
  Show dependency tree
 
Reported: 2002-09-24 21:18 UTC by Havoc Pennington
Modified: 2005-10-07 16:08 UTC (History)
1 user (show)

See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch against metacity-2.5.2 cleans two macros in window.h up (1.59 KB, patch)
2003-06-05 12:59 UTC, Jürg Billeter
none Details | Diff | Review

Description Havoc Pennington 2002-09-24 21:18:50 UTC
This stuff in window.h can't be right, since recalc_window_features sets
has_resize_func etc. based on maximized/fullscreen/etc. state.

#define META_WINDOW_ALLOWS_MOVE(w)     ((w)->has_move_func &&
!(w)->maximized && !(w)->fullscreen)
#define META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS(w)   ((w)->has_resize_func
&& !(w)->maximized && !(w)->fullscreen && !(w)->shaded)
#define META_WINDOW_ALLOWS_RESIZE(w)  
(META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) &&                \
                                        (((w)->size_hints.min_width <
(w)->size_hints.max_width) ||  \
                                         ((w)->size_hints.min_height <
(w)->size_hints.max_height)))
#define META_WINDOW_ALLOWS_HORIZONTAL_RESIZE(w)
(META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && (w)->size_hints.min_width <
(w)->size_hints.max_width)
#define META_WINDOW_ALLOWS_VERTICAL_RESIZE(w)  
(META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && (w)->size_hints.min_height <
(w)->size_hints.max_height)
Comment 1 Heath Harrelson 2002-10-30 15:44:57 UTC
Batch adding GNOME2 keyword to Metacity bugs.  Sorry for the spam.
Comment 2 Jürg Billeter 2003-06-05 12:56:55 UTC
I've tried to make a patch. It isn't a definitive solution as it
doesn't fix Bug 90420 but I don't know the code that well to fix that
bug. For me it seems at least a bit cleaner and my point is that it
won't block Bug 93586 anymore whose patch I want to get applied.
Comment 3 Jürg Billeter 2003-06-05 12:59:46 UTC
Created attachment 17168 [details] [review]
Patch against metacity-2.5.2 cleans two macros in window.h up
Comment 4 Havoc Pennington 2003-06-11 04:29:16 UTC
Hmm, so I went through and tried to figure out what was hosed here.
My code archaeology is:

 - the has_foo_func bitfields are supposed to be invariant 
   regardless of window state; they indicate whether the 
   window's nature allows that operation in general
 - the ALLOWS_FOO macros are supposed to indicate whether 
   the function is *currently* allowed considering state 
   such as fullscreen, maximized, and so forth.

So what looks broken in the current code is the "if
(window->fullscreen) { window->has_foo_func = FALSE; }" stuff 
in recalc_window_features(). However, as that code block exists, 
I bet there is broken code elsewhere that uses has_foo_func 
when it should be using the ALLOWS_FOO macros.

Rob, this kind of mess is why I'm always so nitpicky about what
functions are named, if you were getting frustrated about that. ;-) 

Anyway, perhaps we should rename some of this crap or otherwise
clarify it, and then audit the usages of these various flags.
Since I wrote the code and then clearly misunderstood it 
later on and wrote wrong code on top.

Jürg, now that I understand this better maybe we can apply 
your other patch without having to add a patch here first, 
I'll have a look.
Comment 5 Rob Adams 2003-06-11 06:41:59 UTC
Hey - _I_ didn't write that.  Don't try to foist this one off on me. 
cvsblame reveals that a mysterious cvs user going by "hp" checked
those macros in for window.c revision 1.67. :-)
Comment 6 Havoc Pennington 2003-06-11 07:04:33 UTC
I know you didn't, I'm just pointing out that I get confused easily, 
even if I wrote the stuff. ;-)
Comment 7 Havoc Pennington 2004-05-05 04:31:13 UTC
Comment on attachment 17168 [details] [review]
Patch against metacity-2.5.2 cleans two macros in window.h up

This patch doesn't really address the bug at hand, I think.
Comment 8 Elijah Newren 2005-10-07 16:08:26 UTC
Remove old target milestones on old bugs; sorry for the spam.

Note You need to log in before you can comment on or make changes to this bug.