comparison lib/CanvasShel.c @ 0:92745d501b9a

initial import from kinput2-v3.1
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 08 Mar 2010 04:44:30 +0900
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:92745d501b9a
1 #ifndef lint
2 static char *rcsid = "$Id: CanvasShel.c,v 1.7 1991/09/23 04:03:55 ishisone Rel $";
3 #endif
4 /*
5 * Copyright (c) 1990 Software Research Associates, Inc.
6 *
7 * Permission to use, copy, modify, and distribute this software and its
8 * documentation for any purpose and without fee is hereby granted, provided
9 * that the above copyright notice appear in all copies and that both that
10 * copyright notice and this permission notice appear in supporting
11 * documentation, and that the name of Software Research Associates not be
12 * used in advertising or publicity pertaining to distribution of the
13 * software without specific, written prior permission. Software Research
14 * Associates makes no representations about the suitability of this software
15 * for any purpose. It is provided "as is" without express or implied
16 * warranty.
17 *
18 * Author: Makoto Ishisone, Software Research Associates, Inc., Japan
19 */
20
21 #include <X11/IntrinsicP.h>
22 #include <X11/StringDefs.h>
23 #include "CanvasSheP.h"
24
25 static XtResource resources[] = {
26 #define offset(field) XtOffset(CanvasShellWidget, canvasshell.field)
27 { XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor),
28 offset(cursor), XtRImmediate, (XtPointer)None },
29 { XtNexposeCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
30 offset(exposecallback), XtRCallback, (XtPointer)NULL },
31 { XtNresizeCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
32 offset(resizecallback), XtRCallback, (XtPointer)NULL },
33 #undef offset
34 };
35
36 static void Redisplay();
37 static void Realize();
38 static void Resize();
39 static Boolean SetValues();
40
41 CanvasShellClassRec canvasShellClassRec = {
42 { /* core fields */
43 /* superclass */ (WidgetClass) &adoptedShellClassRec,
44 /* class_name */ "CanvasShell",
45 /* widget_size */ sizeof(CanvasShellRec),
46 /* class_initialize */ NULL,
47 /* class_part_initialize */ NULL,
48 /* class_inited */ FALSE,
49 /* initialize */ NULL,
50 /* initialize_hook */ NULL,
51 /* realize */ Realize,
52 /* actions */ NULL,
53 /* num_actions */ 0,
54 /* resources */ resources,
55 /* num_resources */ XtNumber(resources),
56 /* xrm_class */ NULLQUARK,
57 /* compress_motion */ TRUE,
58 /* compress_exposure */ TRUE,
59 /* compress_enterleave */ TRUE,
60 /* visible_interest */ FALSE,
61 /* destroy */ NULL,
62 /* resize */ Resize,
63 /* expose */ Redisplay,
64 /* set_values */ SetValues,
65 /* set_values_hook */ NULL,
66 /* set_values_almost */ XtInheritSetValuesAlmost,
67 /* get_values_hook */ NULL,
68 /* accept_focus */ NULL,
69 /* version */ XtVersion,
70 /* callback_private */ NULL,
71 /* tm_table */ NULL,
72 /* query_geometry */ XtInheritQueryGeometry,
73 /* display_accelerator */ XtInheritDisplayAccelerator,
74 /* extension */ NULL
75 },
76 { /* Composite */
77 /* geometry_manager */ XtInheritGeometryManager,
78 /* change_managed */ XtInheritChangeManaged,
79 /* insert_child */ XtInheritInsertChild,
80 /* delete_child */ XtInheritDeleteChild,
81 /* extension */ NULL
82 },
83 { /* Shell */
84 /* extension */ NULL
85 },
86 { /* overrideShell fields */
87 /* extension */ NULL
88 },
89 { /* AdoptedShell fields */
90 /* empty */ 0
91 },
92 { /* canvasShell fields */
93 /* empty */ 0
94 }
95 };
96
97 WidgetClass canvasShellWidgetClass = (WidgetClass)&canvasShellClassRec;
98
99 /* ARGSUSED */
100 static void
101 Redisplay(w, event, region)
102 Widget w;
103 XEvent *event;
104 Region region;
105 {
106 CanvasShellWidget csw = (CanvasShellWidget)w;
107
108 XtCallCallbackList(w, csw->canvasshell.exposecallback, (XtPointer)event);
109 }
110
111 static void
112 Resize(w)
113 Widget w;
114 {
115 CanvasShellWidget csw = (CanvasShellWidget)w;
116
117 XtCallCallbackList(w, csw->canvasshell.resizecallback, (XtPointer)NULL);
118 }
119
120 static void
121 Realize(w, maskp, attr)
122 Widget w;
123 XtValueMask *maskp;
124 XSetWindowAttributes *attr;
125 {
126 CanvasShellWidget csw = (CanvasShellWidget)w;
127
128 if (csw->canvasshell.cursor != None) {
129 *maskp |= CWCursor;
130 attr->cursor = csw->canvasshell.cursor;
131 }
132 *maskp |= CWBitGravity;
133 attr->bit_gravity = NorthWestGravity;
134 (*canvasShellWidgetClass->core_class.superclass->core_class.realize)(w, maskp, attr);
135 }
136
137 /* ARGSUSED */
138 static Boolean
139 SetValues(cur, req, new, args, num_args)
140 Widget cur;
141 Widget req;
142 Widget new;
143 ArgList args;
144 Cardinal *num_args;
145 {
146 CanvasShellWidget csw = (CanvasShellWidget)new;
147 CanvasShellWidget old = (CanvasShellWidget)cur;
148
149 if (csw->canvasshell.cursor != old->canvasshell.cursor &&
150 XtIsRealized(new)) {
151 XDefineCursor(XtDisplay(new), XtWindow(new), csw->canvasshell.cursor);
152 }
153
154 return False;
155 }