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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libjava/] [gnu/] [gcj/] [xlib/] [natWindowAttributes.cc] - Blame information for rev 14

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jlechner
/* 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
 
11
#include <gcj/cni.h>
12
#include <gnu/gcj/RawData.h>
13
 
14
#include <gnu/gcj/xlib/Display.h>
15
#include <gnu/gcj/xlib/Window.h>
16
#include <gnu/gcj/xlib/WindowAttributes.h>
17
#include <gnu/gcj/xlib/Pixmap.h>
18
#include <gnu/gcj/xlib/XException.h>
19
#include <gnu/gcj/xlib/Screen.h>
20
#include <gnu/gcj/xlib/Visual.h>
21
 
22
 
23
void gnu::gcj::xlib::WindowAttributes::initFromWindow(Window* from)
24
{
25
  display = from->getDisplay();
26
  ::Display* dpy = (::Display*) display->display;
27
  ::Window win = from->getXID();
28
 
29
  XWindowAttributes* attributesIn  = new XWindowAttributes;
30
  in = reinterpret_cast<gnu::gcj::RawData*>(attributesIn);
31
 
32
  Status status = XGetWindowAttributes(dpy, win, attributesIn);
33
  if ((status == BadDrawable) | (status == BadWindow))
34
    throw new XException(display, status);
35
}
36
 
37
 
38
void gnu::gcj::xlib::WindowAttributes::init(WindowAttributes* copyFrom)
39
{
40
  XSetWindowAttributes* attributes = new XSetWindowAttributes;
41
 
42
  if (copyFrom != 0)
43
    {
44
      XSetWindowAttributes* from =
45
        (XSetWindowAttributes*) copyFrom->out;
46
      (*attributes) = (*from);
47
    }
48
 
49
  out = reinterpret_cast<gnu::gcj::RawData*>(attributes);
50
}
51
 
52
void gnu::gcj::xlib::WindowAttributes::finalize()
53
{
54
  delete in; in = 0;
55
  delete out; out = 0;
56
}
57
 
58
void gnu::gcj::xlib::WindowAttributes::setBackground(jlong pixel)
59
{
60
  XSetWindowAttributes* attributes = (XSetWindowAttributes*) out;
61
 
62
  attributes->background_pixel = pixel;
63
  mask = mask | CWBackPixel;
64
}
65
 
66
void gnu::gcj::xlib::WindowAttributes::setBackground(Pixmap* pixmap)
67
{
68
  XSetWindowAttributes* attributes = (XSetWindowAttributes*) out;
69
 
70
  attributes->background_pixmap = pixmap->getXID();
71
  mask = mask | CWBackPixmap;
72
}
73
 
74
void gnu::gcj::xlib::WindowAttributes::setEventMask(jlong eventMask)
75
{
76
  XSetWindowAttributes* attributes = (XSetWindowAttributes*) out;
77
 
78
  attributes->event_mask = eventMask;
79
  mask = mask | CWEventMask;
80
}
81
 
82
gnu::gcj::xlib::Visual* gnu::gcj::xlib::WindowAttributes::getVisual()
83
{
84
  if (in == 0)
85
    return 0;
86
 
87
  XWindowAttributes* attributesIn = (XWindowAttributes*) in;
88
 
89
  gnu::gcj::RawData* screenRef =
90
    reinterpret_cast<gnu::gcj::RawData*>(attributesIn->screen);
91
 
92
  Screen* screen = new Screen(display, screenRef);
93
 
94
  gnu::gcj::RawData* visualRef =
95
    reinterpret_cast<gnu::gcj::RawData*>(attributesIn->visual);
96
 
97
  return new gnu::gcj::xlib::Visual(visualRef, screen, attributesIn->depth);
98
}
99
 
100
 
101
void gnu::gcj::xlib::WindowAttributes::apply(Window* window)
102
{
103
  ::Display* dpy = (::Display*) window->getDisplay()->display;
104
  ::Window win = window->getXID();
105
  XSetWindowAttributes* attributes = (XSetWindowAttributes*) out;
106
 
107
  XChangeWindowAttributes(dpy, win, mask, attributes);
108
}
109
 

powered by: WebSVN 2.1.0

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