1 /* Copyright (C) 2000 Free Software Foundation
3 This file is part of libgcj.
5 This software is copyrighted work licensed under the terms of the
6 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
10 #include <X11/Xutil.h>
13 #include <gnu/gcj/RawData.h>
14 #include <java/lang/OutOfMemoryError.h>
16 #include <gnu/gcj/xlib/Window.h>
17 #include <gnu/gcj/xlib/Display.h>
18 #include <gnu/gcj/xlib/WMSizeHints.h>
20 void gnu::gcj::xlib::WMSizeHints::init(WMSizeHints
* copyFrom
)
22 XSizeHints
* hints
= XAllocSizeHints();
25 jstring errorMessage
= JvNewStringLatin1("XAllocSizeHints failed");
26 throw new java::lang::OutOfMemoryError(errorMessage
);
31 XSizeHints
* from
= (XSizeHints
*) copyFrom
->structure
;
39 structure
= reinterpret_cast<gnu::gcj::RawData
*>(hints
);
42 void gnu::gcj::xlib::WMSizeHints::finalize()
47 void gnu::gcj::xlib::WMSizeHints::applyNormalHints(gnu::gcj::xlib::Window
* window
)
49 Display
* display
= window
->display
;
50 ::Display
* dpy
= (::Display
*) display
->display
;
51 ::Window win
= window
->getXID();
52 XSizeHints
* hints
= (XSizeHints
*) structure
;
54 XSetWMNormalHints(dpy
, win
, hints
);
55 /* FIXME, alternative?
56 // X11 source reports XSetWMNormalHints() as an old routine. (?)
57 XSetWMSizeHints(dpy, win, hints, display->getAtom("WM_NORMAL_HINTS"));
61 void gnu::gcj::xlib::WMSizeHints::setMinSize(jint width
, jint height
)
63 XSizeHints
* hints
= (XSizeHints
*) structure
;
64 hints
->min_width
= width
;
65 hints
->min_height
= height
;
66 hints
->flags
= hints
->flags
| PMinSize
;
69 void gnu::gcj::xlib::WMSizeHints::setMaxSize(jint width
, jint height
)
71 XSizeHints
* hints
= (XSizeHints
*) structure
;
72 hints
->max_width
= width
;
73 hints
->max_height
= height
;
74 hints
->flags
= hints
->flags
| PMaxSize
;