summaryrefslogtreecommitdiff
path: root/src/Fl_x.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2003-04-03 04:28:15 +0000
committerMatthias Melcher <fltk@matthiasm.com>2003-04-03 04:28:15 +0000
commit7903799bf2ece8f5fdb760c507c1e64ce8418b97 (patch)
treebbca22ac108e37d07b3868ce0571b445d77ce018 /src/Fl_x.cxx
parent14b142f7a8fc71d2b3089bf02711d9831dfaafdf (diff)
- sorted fluid menu bar
- fixed some minor Valgrind memory checker complaints - added conditional compile flag for OS X w/ MetroWerks compiler git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2967 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_x.cxx')
-rw-r--r--src/Fl_x.cxx72
1 files changed, 37 insertions, 35 deletions
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index f74beab82..83b23e707 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_x.cxx,v 1.24.2.24.2.27 2003/03/09 02:00:06 spitzak Exp $"
+// "$Id: Fl_x.cxx,v 1.24.2.24.2.28 2003/04/03 04:28:15 matthiaswm Exp $"
//
// X specific code for the Fast Light Tool Kit (FLTK).
//
@@ -1087,20 +1087,21 @@ void Fl_X::make_xid(Fl_Window* win, XVisualInfo *visual, Colormap colormap)
XChangeProperty(fl_display, xp->xid, fl_XdndAware,
XA_ATOM, sizeof(int)*8, 0, (unsigned char*)&version, 1);
- XWMHints hints;
- hints.input = True;
- hints.flags = InputHint;
+ XWMHints *hints = XAllocWMHints();
+ hints->input = True;
+ hints->flags = InputHint;
if (fl_show_iconic) {
- hints.flags |= StateHint;
- hints.initial_state = IconicState;
+ hints->flags |= StateHint;
+ hints->initial_state = IconicState;
fl_show_iconic = 0;
showit = 0;
}
if (win->icon()) {
- hints.icon_pixmap = (Pixmap)win->icon();
- hints.flags |= IconPixmapHint;
+ hints->icon_pixmap = (Pixmap)win->icon();
+ hints->flags |= IconPixmapHint;
}
- XSetWMHints(fl_display, xp->xid, &hints);
+ XSetWMHints(fl_display, xp->xid, hints);
+ XFree(hints);
}
XMapWindow(fl_display, xp->xid);
@@ -1129,51 +1130,51 @@ void Fl_X::sendxjunk() {
return; // because this recursively called here
}
- XSizeHints hints;
+ XSizeHints *hints = XAllocSizeHints();
// memset(&hints, 0, sizeof(hints)); jreiser suggestion to fix purify?
- hints.min_width = w->minw;
- hints.min_height = w->minh;
- hints.max_width = w->maxw;
- hints.max_height = w->maxh;
- hints.width_inc = w->dw;
- hints.height_inc = w->dh;
- hints.win_gravity = StaticGravity;
+ hints->min_width = w->minw;
+ hints->min_height = w->minh;
+ hints->max_width = w->maxw;
+ hints->max_height = w->maxh;
+ hints->width_inc = w->dw;
+ hints->height_inc = w->dh;
+ hints->win_gravity = StaticGravity;
// see the file /usr/include/X11/Xm/MwmUtil.h:
// fill all fields to avoid bugs in kwm and perhaps other window managers:
// 0, MWM_FUNC_ALL, MWM_DECOR_ALL
long prop[5] = {0, 1, 1, 0, 0};
- if (hints.min_width != hints.max_width ||
- hints.min_height != hints.max_height) { // resizable
- hints.flags = PMinSize|PWinGravity;
- if (hints.max_width >= hints.min_width ||
- hints.max_height >= hints.min_height) {
- hints.flags = PMinSize|PMaxSize|PWinGravity;
+ if (hints->min_width != hints->max_width ||
+ hints->min_height != hints->max_height) { // resizable
+ hints->flags = PMinSize|PWinGravity;
+ if (hints->max_width >= hints->min_width ||
+ hints->max_height >= hints->min_height) {
+ hints->flags = PMinSize|PMaxSize|PWinGravity;
// unfortunately we can't set just one maximum size. Guess a
// value for the other one. Some window managers will make the
// window fit on screen when maximized, others will put it off screen:
- if (hints.max_width < hints.min_width) hints.max_width = Fl::w();
- if (hints.max_height < hints.min_height) hints.max_height = Fl::h();
+ if (hints->max_width < hints->min_width) hints->max_width = Fl::w();
+ if (hints->max_height < hints->min_height) hints->max_height = Fl::h();
}
- if (hints.width_inc && hints.height_inc) hints.flags |= PResizeInc;
+ if (hints->width_inc && hints->height_inc) hints->flags |= PResizeInc;
if (w->aspect) {
// stupid X! It could insist that the corner go on the
// straight line between min and max...
- hints.min_aspect.x = hints.max_aspect.x = hints.min_width;
- hints.min_aspect.y = hints.max_aspect.y = hints.min_height;
- hints.flags |= PAspect;
+ hints->min_aspect.x = hints->max_aspect.x = hints->min_width;
+ hints->min_aspect.y = hints->max_aspect.y = hints->min_height;
+ hints->flags |= PAspect;
}
} else { // not resizable:
- hints.flags = PMinSize|PMaxSize|PWinGravity;
+ hints->flags = PMinSize|PMaxSize|PWinGravity;
prop[0] = 1; // MWM_HINTS_FUNCTIONS
prop[1] = 1|2|16; // MWM_FUNC_ALL | MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE
}
if (w->flags() & Fl_Window::FL_FORCE_POSITION) {
- hints.flags |= USPosition;
- hints.x = w->x();
- hints.y = w->y();
+ hints->flags |= USPosition;
+ hints->x = w->x();
+ hints->y = w->y();
}
if (!w->border()) {
@@ -1181,10 +1182,11 @@ void Fl_X::sendxjunk() {
prop[2] = 0; // no decorations
}
- XSetWMNormalHints(fl_display, xid, &hints);
+ XSetWMNormalHints(fl_display, xid, hints);
XChangeProperty(fl_display, xid,
fl_MOTIF_WM_HINTS, fl_MOTIF_WM_HINTS,
32, 0, (unsigned char *)prop, 5);
+ XFree(hints);
}
void Fl_Window::size_range_() {
@@ -1264,5 +1266,5 @@ void Fl_Window::make_current() {
#endif
//
-// End of "$Id: Fl_x.cxx,v 1.24.2.24.2.27 2003/03/09 02:00:06 spitzak Exp $".
+// End of "$Id: Fl_x.cxx,v 1.24.2.24.2.28 2003/04/03 04:28:15 matthiaswm Exp $".
//