OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [gnu/] [gcj/] [xlib/] [natWMSizeHints.cc] - Blame information for rev 781

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 756 jeremybenn
/* Copyright (C) 2000  Free Software Foundation
2
 
3
   This file is part of libgcj.
4
 
5
This software is copyrighted work licensed under the terms of the
6
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
7
details.  */
8
 
9
#include <X11/Xlib.h>
10
#include <X11/Xutil.h>
11
 
12
#include <gcj/cni.h>
13
#include <gnu/gcj/RawData.h>
14
#include <java/lang/OutOfMemoryError.h>
15
 
16
#include <gnu/gcj/xlib/Window.h>
17
#include <gnu/gcj/xlib/Display.h>
18
#include <gnu/gcj/xlib/WMSizeHints.h>
19
 
20
void gnu::gcj::xlib::WMSizeHints::init(WMSizeHints* copyFrom)
21
{
22
  XSizeHints* hints = XAllocSizeHints();
23
  if (hints == 0)
24
    {
25
      jstring errorMessage = JvNewStringLatin1("XAllocSizeHints failed");
26
      throw new ::java::lang::OutOfMemoryError(errorMessage);
27
    }
28
 
29
  if (copyFrom != 0)
30
    {
31
      XSizeHints* from = (XSizeHints*) copyFrom->structure;
32
      (*hints) = (*from);
33
    }
34
  else
35
    {
36
      // Is this necessary?
37
      hints->flags = 0;
38
    }
39
  structure = reinterpret_cast<gnu::gcj::RawData*>(hints);
40
}
41
 
42
void gnu::gcj::xlib::WMSizeHints::finalize()
43
{
44
  delete structure;
45
}
46
 
47
void gnu::gcj::xlib::WMSizeHints::applyNormalHints(gnu::gcj::xlib::Window* window)
48
{
49
  Display* display = window->display;
50
  ::Display* dpy = (::Display*) display->display;
51
  ::Window win = window->getXID();
52
  XSizeHints* hints = (XSizeHints*) structure;
53
 
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"));
58
  */
59
}
60
 
61
void gnu::gcj::xlib::WMSizeHints::setMinSize(jint width, jint height)
62
{
63
  XSizeHints* hints = (XSizeHints*) structure;
64
  hints->min_width = width;
65
  hints->min_height = height;
66
  hints->flags = hints->flags | PMinSize;
67
}
68
 
69
void gnu::gcj::xlib::WMSizeHints::setMaxSize(jint width, jint height)
70
{
71
  XSizeHints* hints = (XSizeHints*) structure;
72
  hints->max_width = width;
73
  hints->max_height = height;
74
  hints->flags = hints->flags | PMaxSize;
75
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.