annotate Gui/wm/ws.c @ 5333:c4f6ab72300a

eeh 10l, removed one line too much :(
author atmos4
date Mon, 25 Mar 2002 11:35:21 +0000
parents 8e43137d59d8
children 20c335d98ab3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
2 // --------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
3 // AutoSpace Window System for Linux/Win32 v0.85
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
4 // Writed by pontscho/fresh!mindworkz
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
5 // --------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
6
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
7 #include <X11/Xlib.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
8 #include <X11/Xproto.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
9 #include <X11/Xutil.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
10 #include <X11/keysym.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
11 #include <X11/Xatom.h>
2081
efcab819ac24 gcc3 warning fixed
arpi
parents: 2045
diff changeset
12
efcab819ac24 gcc3 warning fixed
arpi
parents: 2045
diff changeset
13 #include <stdio.h>
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
14 #include <stdlib.h>
2081
efcab819ac24 gcc3 warning fixed
arpi
parents: 2045
diff changeset
15 #include <string.h>
efcab819ac24 gcc3 warning fixed
arpi
parents: 2045
diff changeset
16 #include <unistd.h>
efcab819ac24 gcc3 warning fixed
arpi
parents: 2045
diff changeset
17 #include <errno.h>
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
18
2733
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
19 #include <inttypes.h>
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
20
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4566
diff changeset
21 #include "../../config.h"
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
22 #include "ws.h"
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
23 #include "wsconv.h"
2733
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
24 #include "../../postproc/rgb2rgb.h"
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
25
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
26 #include <X11/extensions/XShm.h>
2476
a6c5a537f30a a few warning fixes (missing #include's)
pl
parents: 2081
diff changeset
27 #ifdef HAVE_XSHAPE
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
28 #include <X11/extensions/shape.h>
2476
a6c5a537f30a a few warning fixes (missing #include's)
pl
parents: 2081
diff changeset
29 #endif
a6c5a537f30a a few warning fixes (missing #include's)
pl
parents: 2081
diff changeset
30
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
31 #include <sys/ipc.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
32 #include <sys/shm.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
33
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
34 typedef struct
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
35 {
3054
9507f90d8254 add half dvd support for gui
pontscho
parents: 2981
diff changeset
36 unsigned long flags;
9507f90d8254 add half dvd support for gui
pontscho
parents: 2981
diff changeset
37 unsigned long functions;
9507f90d8254 add half dvd support for gui
pontscho
parents: 2981
diff changeset
38 unsigned long decorations;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
39 long input_mode;
3054
9507f90d8254 add half dvd support for gui
pontscho
parents: 2981
diff changeset
40 unsigned long status;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
41 } MotifWmHints;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
42
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
43 Atom wsMotifHints;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
44
4465
b013d01d9968 small bugfixes, and kill other warning
pontscho
parents: 4411
diff changeset
45 int wsMaxX = 0; // Screen width.
b013d01d9968 small bugfixes, and kill other warning
pontscho
parents: 4411
diff changeset
46 int wsMaxY = 0; // Screen height.
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
47
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
48 Display * wsDisplay;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
49 int wsScreen;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
50 Window wsRootWin;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
51 XEvent wsEvent;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
52 int wsWindowDepth;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
53 GC wsHGC;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
54 MotifWmHints wsMotifWmHints;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
55 Atom wsTextProperlyAtom = None;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
56
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
57 int wsDepthOnScreen = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
58 int wsRedMask = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
59 int wsGreenMask = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
60 int wsBlueMask = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
61 int wsOutMask = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
62
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
63 int wsTrue = True;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
64
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
65 wsTWindow * wsWindowList[5] = { NULL,NULL,NULL,NULL,NULL };
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
66 int wsWLCount = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
67
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
68 unsigned long wsKeyTable[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
69
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
70 int wsUseXShm = 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
71 int wsUseXShape = 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
72
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
73 int XShmGetEventBase( Display* );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
74 inline int wsSearch( Window win );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
75
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
76 #define MWM_HINTS_FUNCTIONS (1L << 0)
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
77 #define MWM_HINTS_DECORATIONS (1L << 1)
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
78 #define MWM_HINTS_INPUT_MODE (1L << 2)
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
79 #define MWM_HINTS_STATUS (1L << 3)
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
80
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
81 #define MWM_FUNC_ALL (1L << 0)
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
82 #define MWM_FUNC_RESIZE (1L << 1)
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
83 #define MWM_FUNC_MOVE (1L << 2)
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
84 #define MWM_FUNC_MINIMIZE (1L << 3)
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
85 #define MWM_FUNC_MAXIMIZE (1L << 4)
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
86 #define MWM_FUNC_CLOSE (1L << 5)
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
87
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
88 #define MWM_DECOR_ALL (1L << 0)
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
89 #define MWM_DECOR_BORDER (1L << 1)
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
90 #define MWM_DECOR_RESIZEH (1L << 2)
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
91 #define MWM_DECOR_TITLE (1L << 3)
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
92 #define MWM_DECOR_MENU (1L << 4)
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
93 #define MWM_DECOR_MINIMIZE (1L << 5)
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
94 #define MWM_DECOR_MAXIMIZE (1L << 6)
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
95
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
96 #define MWM_INPUT_MODELESS 0
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
97 #define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
98 #define MWM_INPUT_SYSTEM_MODAL 2
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
99 #define MWM_INPUT_FULL_APPLICATION_MODAL 3
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
100 #define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
101
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
102 #define MWM_TEAROFF_WINDOW (1L<<0)
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
103
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
104 void wsWindowDecoration( wsTWindow * win,long d )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
105 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
106 wsMotifHints=XInternAtom( wsDisplay,"_MOTIF_WM_HINTS",0 );
3054
9507f90d8254 add half dvd support for gui
pontscho
parents: 2981
diff changeset
107 if ( wsMotifHints == None ) return;
9507f90d8254 add half dvd support for gui
pontscho
parents: 2981
diff changeset
108
9507f90d8254 add half dvd support for gui
pontscho
parents: 2981
diff changeset
109 memset( &wsMotifWmHints,0,sizeof( MotifWmHints ) );
5031
8e43137d59d8 rewrite MWM hint handling
pontscho
parents: 4818
diff changeset
110 wsMotifWmHints.flags=MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
8e43137d59d8 rewrite MWM hint handling
pontscho
parents: 4818
diff changeset
111 if ( d )
8e43137d59d8 rewrite MWM hint handling
pontscho
parents: 4818
diff changeset
112 {
8e43137d59d8 rewrite MWM hint handling
pontscho
parents: 4818
diff changeset
113 wsMotifWmHints.functions=MWM_FUNC_MOVE | MWM_FUNC_CLOSE | MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE | MWM_FUNC_RESIZE;
8e43137d59d8 rewrite MWM hint handling
pontscho
parents: 4818
diff changeset
114 wsMotifWmHints.decorations=MWM_DECOR_ALL;
8e43137d59d8 rewrite MWM hint handling
pontscho
parents: 4818
diff changeset
115 }
3054
9507f90d8254 add half dvd support for gui
pontscho
parents: 2981
diff changeset
116 XChangeProperty( wsDisplay,win->WindowID,wsMotifHints,wsMotifHints,32,
9507f90d8254 add half dvd support for gui
pontscho
parents: 2981
diff changeset
117 PropModeReplace,(unsigned char *)&wsMotifWmHints,5 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
118 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
119
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
120 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
121 // Init X Window System.
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
122 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
123
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
124 int wsIOErrorHandler( Display * dpy )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
125 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
126 fprintf( stderr,"[ws] io error in display.\n" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
127 exit( 0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
128 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
129
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
130 int wsErrorHandler( Display * dpy,XErrorEvent * Event )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
131 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
132 char type[128];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
133 XGetErrorText( wsDisplay,Event->error_code,type,128 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
134 fprintf(stderr,"[ws] Error in display.\n");
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
135 fprintf(stderr,"[ws] Error code: %d ( %s )\n",Event->error_code,type );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
136 fprintf(stderr,"[ws] Request code: %d\n",Event->request_code );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
137 fprintf(stderr,"[ws] Minor code: %d\n",Event->minor_code );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
138 exit( 0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
139 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
140
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1709
diff changeset
141 void wsXInit( void* mDisplay )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
142 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
143 int eventbase;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
144 int errorbase;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
145
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1709
diff changeset
146 if(mDisplay){
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1709
diff changeset
147 wsDisplay=mDisplay;
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1709
diff changeset
148 } else {
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1709
diff changeset
149 char * DisplayName = ":0.0";
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
150 if ( getenv( "DISPLAY" ) ) DisplayName=getenv( "DISPLAY" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
151 wsDisplay=XOpenDisplay( DisplayName );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
152 if ( !wsDisplay )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
153 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
154 fprintf( stderr,"[ws] couldn't open the display !\n" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
155 exit( 0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
156 }
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1709
diff changeset
157 }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
158
1838
4984bd55518e add lgb's localhost detect
pontscho
parents: 1823
diff changeset
159 { /* on remote display XShm will be disabled - LGB */
4984bd55518e add lgb's localhost detect
pontscho
parents: 1823
diff changeset
160 char *dispname=DisplayString(wsDisplay);
4984bd55518e add lgb's localhost detect
pontscho
parents: 1823
diff changeset
161 int localdisp=1;
4984bd55518e add lgb's localhost detect
pontscho
parents: 1823
diff changeset
162 if (dispname&&*dispname!=':') {
4984bd55518e add lgb's localhost detect
pontscho
parents: 1823
diff changeset
163 localdisp=0;
4984bd55518e add lgb's localhost detect
pontscho
parents: 1823
diff changeset
164 wsUseXShm=0;
4984bd55518e add lgb's localhost detect
pontscho
parents: 1823
diff changeset
165 }
4984bd55518e add lgb's localhost detect
pontscho
parents: 1823
diff changeset
166 fprintf(stderr,"[ws] Display name: %s => %s display.\n",dispname,localdisp?"local":"REMOTE");
4984bd55518e add lgb's localhost detect
pontscho
parents: 1823
diff changeset
167 if (!localdisp) fprintf(stderr,"[ws] Remote display, disabling XMITSHM\n");
4984bd55518e add lgb's localhost detect
pontscho
parents: 1823
diff changeset
168 }
4984bd55518e add lgb's localhost detect
pontscho
parents: 1823
diff changeset
169
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
170 if ( !XShmQueryExtension( wsDisplay ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
171 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
172 fprintf( stderr,"[ws] sorry, your system is not supported X shared memory extension.\n" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
173 wsUseXShm=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
174 }
1699
7ddc63b84f1f DGA2 ifdefs, new mainloop/timer stuff
arpi
parents: 1693
diff changeset
175 #ifdef HAVE_XSHAPE
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
176 if ( !XShapeQueryExtension( wsDisplay,&eventbase,&errorbase ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
177 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
178 fprintf( stderr,"[ws] sorry, your system is not supported XShape extension.\n" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
179 wsUseXShape=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
180 }
1699
7ddc63b84f1f DGA2 ifdefs, new mainloop/timer stuff
arpi
parents: 1693
diff changeset
181 #else
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
182 wsUseXShape=0;
1699
7ddc63b84f1f DGA2 ifdefs, new mainloop/timer stuff
arpi
parents: 1693
diff changeset
183 #endif
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
184
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
185 XSynchronize( wsDisplay,True );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
186
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
187 wsScreen=DefaultScreen( wsDisplay );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
188 wsRootWin=RootWindow( wsDisplay,wsScreen );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
189 wsMaxX=DisplayWidth( wsDisplay,wsScreen );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
190 wsMaxY=DisplayHeight( wsDisplay,wsScreen );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
191
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
192 wsGetDepthOnScreen();
1699
7ddc63b84f1f DGA2 ifdefs, new mainloop/timer stuff
arpi
parents: 1693
diff changeset
193 #ifdef DEBUG
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
194 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
195 int minor,major,shp;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
196 fprintf( stderr,"[ws] Screen depth: %d\n",wsDepthOnScreen );
2029
41ed89701ece fix fucking icewm fullscreen bug.
pontscho
parents: 1860
diff changeset
197 fprintf( stderr,"[ws] size: %dx%d\n",wsMaxX,wsMaxY );
41ed89701ece fix fucking icewm fullscreen bug.
pontscho
parents: 1860
diff changeset
198 fprintf( stderr,"[ws] red mask: 0x%x\n",wsRedMask );
41ed89701ece fix fucking icewm fullscreen bug.
pontscho
parents: 1860
diff changeset
199 fprintf( stderr,"[ws] green mask: 0x%x\n",wsGreenMask );
41ed89701ece fix fucking icewm fullscreen bug.
pontscho
parents: 1860
diff changeset
200 fprintf( stderr,"[ws] blue mask: 0x%x\n",wsBlueMask );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
201 if ( wsUseXShm )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
202 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
203 XShmQueryVersion( wsDisplay,&major,&minor,&shp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
204 fprintf( stderr,"[ws] XShm version is %d.%d\n",major,minor );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
205 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
206 #ifdef HAVE_XSHAPE
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
207 if ( wsUseXShape )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
208 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
209 XShapeQueryVersion( wsDisplay,&major,&minor );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
210 fprintf( stderr,"[ws] XShape version is %d.%d\n",major,minor );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
211 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
212 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
213 }
1699
7ddc63b84f1f DGA2 ifdefs, new mainloop/timer stuff
arpi
parents: 1693
diff changeset
214 #endif
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
215 initConverter();
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
216 wsOutMask=wsGetOutMask();
2733
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
217 #ifdef DEBUG
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
218 fprintf( stderr,"[ws] Initialized converter: " );
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
219 #endif
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
220 switch ( wsOutMask )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
221 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
222 case wsRGB32:
2733
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
223 #ifdef DEBUG
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
224 fprintf( stderr,"rgb32 to rgb32\n" );
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
225 #endif
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
226 wsConvFunc=BGR8880_to_RGB8880_c;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
227 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
228 case wsBGR32:
2733
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
229 #ifdef DEBUG
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
230 fprintf( stderr,"rgb32 to bgr32\n" );
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
231 #endif
2782
b52d3e6ff4ab app michale's rgb32tobgr32
pontscho
parents: 2733
diff changeset
232 // wsConvFunc=BGR8880_to_BGR8880_c;
b52d3e6ff4ab app michale's rgb32tobgr32
pontscho
parents: 2733
diff changeset
233 wsConvFunc=rgb32tobgr32;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
234 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
235 case wsRGB24:
2733
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
236 #ifdef DEBUG
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
237 fprintf( stderr,"rgb32 to rgb24\n" );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
238 #endif
2733
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
239 wsConvFunc=rgb32to24;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
240 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
241 case wsBGR24:
2733
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
242 #ifdef DEBUG
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
243 fprintf( stderr,"rgb32 to bgr24\n" );
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
244 #endif
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
245 wsConvFunc=BGR8880_to_BGR888_c;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
246 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
247 case wsRGB16:
2733
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
248 #ifdef DEBUG
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
249 fprintf( stderr,"rgb32 to rgb16\n" );
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
250 #endif
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
251 wsConvFunc=rgb32to16;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
252 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
253 case wsBGR16:
2733
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
254 #ifdef DEBUG
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
255 fprintf( stderr,"rgb32 to bgr16\n" );
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
256 #endif
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
257 wsConvFunc=BGR8880_to_BGR565_c;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
258 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
259 case wsRGB15:
2733
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
260 #ifdef DEBUG
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
261 fprintf( stderr,"rgb32 to rgb15\n" );
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
262 #endif
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
263 wsConvFunc=rgb32to15;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
264 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
265 case wsBGR15:
2733
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
266 #ifdef DEBUG
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
267 fprintf( stderr,"rgb32 to bgr15\n" );
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
268 #endif
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
269 wsConvFunc=BGR8880_to_BGR555_c;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
270 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
271 }
2981
4db0210755eb hm. kurva hibakezeles
pontscho
parents: 2854
diff changeset
272 // XSetIOErrorHandler( wsIOErrorHandler );
4db0210755eb hm. kurva hibakezeles
pontscho
parents: 2854
diff changeset
273 // XSetErrorHandler( wsErrorHandler );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
274 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
275
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
276 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
277 // Create window.
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
278 // X,Y : window position
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
279 // wX,wY : size of window
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
280 // bW : border width
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
281 // cV : visible mouse cursor on window
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
282 // D : visible frame, title, etc.
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
283 // sR : screen ratio
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
284 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
285
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
286 XClassHint wsClassHint;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
287 XTextProperty wsTextProperty;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
288 Window LeaderWindow;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
289
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
290 void wsCreateWindow( wsTWindow * win,int X,int Y,int wX,int hY,int bW,int cV,unsigned char D,char * label )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
291 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
292 win->Property=D;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
293 if ( D & wsShowFrame ) win->Decorations=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
294 wsHGC=DefaultGC( wsDisplay,wsScreen );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
295 // The window position and size.
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
296 switch ( X )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
297 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
298 case -1: win->X=( wsMaxX / 2 ) - ( wX / 2 ); break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
299 case -2: win->X=wsMaxX - wX - 1; break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
300 default: win->X=X; break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
301 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
302 switch ( Y )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
303 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
304 case -1: win->Y=( wsMaxY / 2 ) - ( hY / 2 ); break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
305 case -2: win->Y=wsMaxY - hY - 1; break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
306 default: win->Y=Y; break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
307 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
308 win->Width=wX;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
309 win->Height=hY;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
310 win->OldX=win->X;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
311 win->OldY=win->Y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
312 win->OldWidth=win->Width;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
313 win->OldHeight=win->Height;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
314
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
315 // Border size for window.
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
316 win->BorderWidth=bW;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
317 // Hide Mouse Cursor
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
318 win->wsCursor=None;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
319 win->wsMouseEventType=cV;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
320 win->wsCursorData[0]=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
321 win->wsCursorPixmap=XCreateBitmapFromData( wsDisplay,wsRootWin,win->wsCursorData,1,1 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
322 if ( !(cV & wsShowMouseCursor) ) win->wsCursor=XCreatePixmapCursor( wsDisplay,win->wsCursorPixmap,win->wsCursorPixmap,&win->wsColor,&win->wsColor,0,0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
323
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
324 XGetWindowAttributes( wsDisplay,wsRootWin,&win->Attribs );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
325 if ( win->Attribs.depth < 15 )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
326 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
327 fprintf( stderr,"[ws] sorry, this color depth is not enough.\n" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
328 exit( 0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
329 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
330 XMatchVisualInfo( wsDisplay,wsScreen,win->Attribs.depth,TrueColor,&win->VisualInfo );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
331
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
332 // ---
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
333 win->AtomLeaderClient=XInternAtom( wsDisplay,"WM_CLIENT_LEADER",False );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
334 win->AtomDeleteWindow=XInternAtom( wsDisplay,"WM_DELETE_WINDOW",False );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
335 win->AtomTakeFocus=XInternAtom( wsDisplay,"WM_TAKE_FOCUS",False );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
336 win->AtomRolle=XInternAtom( wsDisplay,"WM_WINDOW_ROLE",False );
2851
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
337 win->AtomWMSizeHint=XInternAtom( wsDisplay,"WM_SIZE_HINT",False );
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
338 win->AtomWMNormalHint=XInternAtom( wsDisplay,"WM_NORMAL_HINT",False );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
339 win->AtomProtocols=XInternAtom( wsDisplay,"WM_PROTOCOLS",False );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
340 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
341 char buf[32]; int i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
342 sprintf( buf,"_%s_REMOTE",label );
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4566
diff changeset
343 for( i=0;i < (int)strlen( buf );i++ )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
344 if ( ( buf[i] >= 'a' )&&( buf[i] <= 'z' ) ) buf[i]=buf[i] - 32;
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4566
diff changeset
345 for( i=0;i < (int)strlen( buf );i++ )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
346 if ( buf[i] == ' ' ) buf[i]='_';
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
347 fprintf( stderr,"[ws] atomname: %s\n",buf );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
348 win->AtomRemote=XInternAtom( wsDisplay,buf,False );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
349 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
350 win->AtomsProtocols[0]=win->AtomDeleteWindow;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
351 win->AtomsProtocols[1]=win->AtomTakeFocus;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
352 win->AtomsProtocols[2]=win->AtomRolle;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
353 // ---
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
354
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
355 // win->WindowAttrib.background_pixel=BlackPixel( wsDisplay,wsScreen );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
356 // win->WindowAttrib.border_pixel=BlackPixel( wsDisplay,wsScreen );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
357 win->WindowAttrib.background_pixel=BlackPixel( wsDisplay,wsScreen );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
358 win->WindowAttrib.border_pixel=WhitePixel( wsDisplay,wsScreen );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
359 win->WindowAttrib.colormap=XCreateColormap( wsDisplay,wsRootWin,win->VisualInfo.visual,AllocNone );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
360 win->WindowAttrib.event_mask=StructureNotifyMask | FocusChangeMask |
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
361 //SubstructureRedirectMask |
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
362 //SubstructureNotifyMask |
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
363 //ResizeRedirectMask |
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
364 //GCGraphicsExposures |
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
365 ExposureMask | PropertyChangeMask |
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
366 EnterWindowMask | LeaveWindowMask |
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
367 VisibilityChangeMask |
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
368 KeyPressMask | KeyReleaseMask;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
369 if ( ( cV & wsHandleMouseButton ) ) win->WindowAttrib.event_mask|=ButtonPressMask | ButtonReleaseMask;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
370 if ( ( cV & wsHandleMouseMove ) ) win->WindowAttrib.event_mask|=PointerMotionMask;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
371 win->WindowAttrib.cursor=win->wsCursor;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
372 win->WindowAttrib.override_redirect=False;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
373 if ( D & wsOverredirect ) win->WindowAttrib.override_redirect=True;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
374
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
375 // win->WindowAttrib.save_under=True;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
376 // win->WindowAttrib.do_not_propagate_mask = True;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
377
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
378 win->WindowMask=CWBackPixel | CWBorderPixel |
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
379 CWColormap | CWEventMask | CWCursor |
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
380 CWX | CWY | CWWidth | CWHeight |
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
381 CWOverrideRedirect;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
382
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
383 win->WindowID=XCreateWindow( wsDisplay,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
384 (win->Parent != 0?win->Parent:wsRootWin),
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
385 win->X,win->Y,win->Width,win->Height,win->BorderWidth,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
386 win->VisualInfo.depth,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
387 InputOutput,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
388 win->VisualInfo.visual,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
389 win->WindowMask,&win->WindowAttrib );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
390
4411
a97f908988ed small changes
pontscho
parents: 3055
diff changeset
391 #if 0
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
392 wsClassHint.res_name=label;
4411
a97f908988ed small changes
pontscho
parents: 3055
diff changeset
393 #else
a97f908988ed small changes
pontscho
parents: 3055
diff changeset
394 wsClassHint.res_name="MPlayer";
a97f908988ed small changes
pontscho
parents: 3055
diff changeset
395 #endif
a97f908988ed small changes
pontscho
parents: 3055
diff changeset
396
2029
41ed89701ece fix fucking icewm fullscreen bug.
pontscho
parents: 1860
diff changeset
397 wsClassHint.res_class="MPlayer";
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
398 XSetClassHint( wsDisplay,win->WindowID,&wsClassHint );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
399
2851
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
400 win->SizeHint.flags=PPosition | PSize | PResizeInc | PWinGravity; // | PBaseSize
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
401 win->SizeHint.x=win->X;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
402 win->SizeHint.y=win->Y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
403 win->SizeHint.width=win->Width;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
404 win->SizeHint.height=win->Height;
1860
c65abbc91c5c fix mwm bug's. faszom (C), and remove mixer.*
pontscho
parents: 1858
diff changeset
405 if ( D & wsMinSize )
c65abbc91c5c fix mwm bug's. faszom (C), and remove mixer.*
pontscho
parents: 1858
diff changeset
406 {
c65abbc91c5c fix mwm bug's. faszom (C), and remove mixer.*
pontscho
parents: 1858
diff changeset
407 win->SizeHint.flags|=PMinSize;
c65abbc91c5c fix mwm bug's. faszom (C), and remove mixer.*
pontscho
parents: 1858
diff changeset
408 win->SizeHint.min_width=win->Width;
c65abbc91c5c fix mwm bug's. faszom (C), and remove mixer.*
pontscho
parents: 1858
diff changeset
409 win->SizeHint.min_height=win->Height;
c65abbc91c5c fix mwm bug's. faszom (C), and remove mixer.*
pontscho
parents: 1858
diff changeset
410 }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
411 if ( D & wsMaxSize )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
412 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
413 win->SizeHint.flags|=PMaxSize;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
414 win->SizeHint.max_width=win->Width;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
415 win->SizeHint.max_height=win->Height;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
416 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
417 win->SizeHint.height_inc=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
418 win->SizeHint.width_inc=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
419 // win->SizeHint.base_width=win->Width;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
420 // win->SizeHint.base_height=win->Height;
2851
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
421 win->SizeHint.win_gravity=StaticGravity;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
422 XSetWMNormalHints( wsDisplay,win->WindowID,&win->SizeHint );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
423
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
424 win->WMHints.flags=InputHint | StateHint;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
425 win->WMHints.input=True;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
426 win->WMHints.initial_state=NormalState;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
427 XSetWMHints( wsDisplay,win->WindowID,&win->WMHints );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
428
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
429 wsWindowDecoration( win,win->Decorations );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
430 XStoreName( wsDisplay,win->WindowID,label );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
431 XmbSetWMProperties( wsDisplay,win->WindowID,label,label,NULL,0,NULL,NULL,NULL );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
432
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
433 XSetWMProtocols( wsDisplay,win->WindowID,win->AtomsProtocols,3 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
434 XChangeProperty( wsDisplay,win->WindowID,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
435 win->AtomLeaderClient,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
436 XA_WINDOW,32,PropModeReplace,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
437 (unsigned char *)&LeaderWindow,1 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
438
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
439 wsTextProperty.value=label;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
440 wsTextProperty.encoding=XA_STRING;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
441 wsTextProperty.format=8;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
442 wsTextProperty.nitems=strlen( label );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
443 XSetWMIconName( wsDisplay,win->WindowID,&wsTextProperty );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
444
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
445 XChangeProperty( wsDisplay,win->WindowID,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
446 win->AtomRemote,XA_STRING,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
447 8,PropModeReplace,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
448 "REALIZED",8 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
449
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
450 // win->Font=XLoadQueryFont( wsDisplay,"-adobe-helvetica-bold-r-normal--14-140-75-75-p-77-iso8859-1" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
451 // -adobe-times-medium-r-normal--14-140-75-75-p-77-iso8859-1" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
452 // -misc-fixed-bold-r-normal--13-120-75-75-C-80-iso8859-1" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
453 // -misc-fixed-bold-r-normal--15-140-75-75-C-90-iso8859-1" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
454 // -misc-fixed-medium-r-normal--15-140-75-75-C-90-iso8859-1" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
455 // -adobe-times-medium-r-normal--24-240-75-75-p-124-iso8859-1" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
456 // -adobe-helvetica-medium-r-normal--10-100-75-75-p-56-iso8859-1" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
457 // -*-helvetica-bold-o-normal--14-*-*-*-p-*-iso8859-1" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
458 // if ( !win->Font ) win->Font=XLoadQueryFont( wsDisplay,"fixed" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
459 // if ( !win->Font )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
460 // {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
461 // fprintf( stderr,"[main] could not load font.\n" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
462 // exit( 0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
463 // }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
464 // win->FontHeight=win->Font->ascent + win->Font->descent;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
465 //
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
466 // #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
467 // fprintf( stderr,"[ws] font height: %d\n",win->FontHeight );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
468 // #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
469
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
470 // win->wGCV.font=win->Font->fid;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
471 // win->wGCV.foreground=wsBlack;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
472 // win->wGCV.background=wsBlack;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
473
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
474 win->wGC=XCreateGC( wsDisplay,win->WindowID,
1814
9c674dc76ff3 add wsSetForegroundRGB
pontscho
parents: 1810
diff changeset
475 GCForeground | GCBackground,
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
476 &win->wGCV );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
477
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
478 win->Visible=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
479 win->Focused=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
480 win->Mapped=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
481 win->Rolled=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
482 if ( D & wsShowWindow ) XMapWindow( wsDisplay,win->WindowID );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
483
1858
88a88d0a3f94 fix skin changing, xv fullscreen redraw bug, etc.
pontscho
parents: 1853
diff changeset
484 wsCreateImage( win,win->Width,win->Height );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
485 // --- End of creating --------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
486
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
487 wsWindowList[wsWLCount++]=win;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
488
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
489 XFlush( wsDisplay );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
490 XSync( wsDisplay,False );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
491
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
492 win->ReDraw=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
493 win->ReSize=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
494 win->Idle=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
495 win->MouseHandler=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
496 win->KeyHandler=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
497 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
498 fprintf( stderr,"[ws] window is created. ( %s ).\n",label );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
499 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
500 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
501
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
502 void wsDestroyWindow( wsTWindow * win )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
503 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
504 int l;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
505 l=wsSearch( win->WindowID );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
506 wsWindowList[l]=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
507 if ( win->wsCursor != None )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
508 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
509 XFreeCursor( wsDisplay,win->wsCursor );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
510 win->wsCursor=None;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
511 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
512 XUnmapWindow( wsDisplay,win->WindowID );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
513 wsDestroyImage( win );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
514 XDestroyWindow( wsDisplay,win->WindowID );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
515 win->ReDraw=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
516 win->ReSize=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
517 win->Idle=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
518 win->MouseHandler=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
519 win->KeyHandler=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
520 win->Visible=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
521 win->Focused=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
522 win->Mapped=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
523 win->Rolled=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
524 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
525
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
526 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
527 // Handle events.
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
528 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
529
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
530 inline int wsSearch( Window win )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
531 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
532 int i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
533 for ( i=0;i<wsWLCount;i++ ) if ( wsWindowList[i]->WindowID == win ) return i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
534 return -1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
535 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
536
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
537 Bool wsEvents( Display * display,XEvent * Event,XPointer arg )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
538 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
539 KeySym keySym;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
540 unsigned long i = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
541 int l;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
542 int x,y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
543 Window child_window = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
544
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
545 l=wsSearch( Event->xany.window );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
546 if ( l == -1 ) return !wsTrue;
1782
dce42eebfda4 win->state fix
pontscho
parents: 1779
diff changeset
547 wsWindowList[l]->State=0;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
548 switch( Event->type )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
549 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
550 case ClientMessage:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
551 if ( Event->xclient.message_type == wsWindowList[l]->AtomProtocols )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
552 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
553 if ( Event->xclient.data.l[0] == wsWindowList[l]->AtomDeleteWindow )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
554 { wsTrue=False; break; }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
555 if ( Event->xclient.data.l[0] == wsWindowList[l]->AtomTakeFocus )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
556 { i=wsWindowFocusIn; wsWindowList[l]->Focused=wsFocused; goto expose; }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
557 if ( Event->xclient.data.l[0] == wsWindowList[l]->AtomRolle )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
558 { fprintf( stderr,"[ws] rolled.\n" ); }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
559 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
560 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
561
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
562 // case CirculateRequest:fprintf( stderr,"[ws,r] win: 0x%x\n",(int)Event->xcirculaterequest.window ); break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
563 // case CirculateNotify: fprintf( stderr,"[ws,c] win: 0x%x\n",(int)Event->xcirculate.window ); break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
564
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
565 case MapNotify: i=wsWindowMapped; wsWindowList[l]->Mapped=wsMapped; goto expose;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
566 case UnmapNotify: i=wsWindowUnmapped; wsWindowList[l]->Mapped=wsNone; goto expose;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
567 case FocusIn:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
568 if ( wsWindowList[l]->Focused == wsFocused ) break;
2851
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
569 i=wsWindowFocusIn;
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
570 wsWindowList[l]->Focused=wsFocused;
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
571 goto expose;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
572 case FocusOut:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
573 if ( wsWindowList[l]->Focused == wsNone ) break;
2851
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
574 i=wsWindowFocusOut;
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
575 wsWindowList[l]->Focused=wsNone;
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
576 goto expose;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
577 case VisibilityNotify:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
578 switch( Event->xvisibility.state )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
579 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
580 case VisibilityUnobscured: i=wsWindowVisible; wsWindowList[l]->Visible=wsVisible; goto expose;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
581 case VisibilityFullyObscured: i=wsWindowNotVisible; wsWindowList[l]->Visible=wsNotVisible; goto expose;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
582 case VisibilityPartiallyObscured: i=wsWindowPartialVisible; wsWindowList[l]->Visible=wsPVisible; goto expose;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
583 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
584 expose:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
585 wsWindowList[l]->State=i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
586 if ( wsWindowList[l]->ReDraw ) wsWindowList[l]->ReDraw( wsDisplay,Event->xany.window );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
587 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
588
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
589 case Expose:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
590 wsWindowList[l]->State=wsWindowExpose;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
591 if ( ( wsWindowList[l]->ReDraw )&&( !Event->xexpose.count ) ) wsWindowList[l]->ReDraw( wsDisplay,Event->xany.window );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
592 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
593
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
594 case ConfigureNotify:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
595 XTranslateCoordinates( wsDisplay,wsWindowList[l]->WindowID,wsRootWin,0,0,&x,&y,&child_window );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
596 if ( ( wsWindowList[l]->X != x )||( wsWindowList[l]->Y != y )||( wsWindowList[l]->Width != Event->xconfigure.width )||( wsWindowList[l]->Height != Event->xconfigure.height ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
597 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
598 wsWindowList[l]->X=x; wsWindowList[l]->Y=y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
599 wsWindowList[l]->Width=Event->xconfigure.width; wsWindowList[l]->Height=Event->xconfigure.height;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
600 // fprintf( stderr,"[ws] resize: %d,%d %dx%d\n",wsWindowList[l]->X,wsWindowList[l]->Y,Event->xconfigure.width,Event->xconfigure.height );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
601 if ( wsWindowList[l]->ReSize ) wsWindowList[l]->ReSize( wsWindowList[l]->X,wsWindowList[l]->Y,wsWindowList[l]->Width,wsWindowList[l]->Height );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
602 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
603
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
604 wsWindowList[l]->Rolled=wsNone;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
605 if ( Event->xconfigure.y < 0 )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
606 { i=wsWindowRolled; wsWindowList[l]->Rolled=wsRolled; goto expose; }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
607
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
608 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
609
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
610 case KeyPress: i=wsKeyPressed; goto keypressed;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
611 case KeyRelease: i=wsKeyReleased;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
612 keypressed:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
613 wsWindowList[l]->Alt=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
614 wsWindowList[l]->Shift=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
615 wsWindowList[l]->NumLock=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
616 wsWindowList[l]->Control=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
617 wsWindowList[l]->CapsLock=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
618 if ( Event->xkey.state & Mod1Mask ) wsWindowList[l]->Alt=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
619 if ( Event->xkey.state & Mod2Mask ) wsWindowList[l]->NumLock=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
620 if ( Event->xkey.state & ControlMask ) wsWindowList[l]->Control=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
621 if ( Event->xkey.state & ShiftMask ) wsWindowList[l]->Shift=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
622 if ( Event->xkey.state & LockMask ) wsWindowList[l]->CapsLock=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
623 keySym=XKeycodeToKeysym( wsDisplay,Event->xkey.keycode,0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
624 if ( keySym != NoSymbol )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
625 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
626 keySym=( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
627 wsKeyTable[ keySym ]=i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
628 if ( wsWindowList[l]->KeyHandler )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
629 wsWindowList[l]->KeyHandler( Event->xkey.state,i,keySym );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
630 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
631 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
632
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
633 case MotionNotify: i=wsMoveMouse; goto buttonreleased;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
634 case ButtonRelease: i=Event->xbutton.button + 128; goto buttonreleased;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
635 case ButtonPress: i=Event->xbutton.button; goto buttonreleased;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
636 case EnterNotify: i=wsEnterWindow; goto buttonreleased;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
637 case LeaveNotify: i=wsLeaveWindow;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
638 buttonreleased:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
639 if ( wsWindowList[l]->MouseHandler )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
640 wsWindowList[l]->MouseHandler( i,Event->xbutton.x,Event->xbutton.y,Event->xmotion.x_root,Event->xmotion.y_root );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
641 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
642
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4566
diff changeset
643 // case GravityNotify:
2851
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
644 // #ifdef DEBUG
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4566
diff changeset
645 // fprintf( stderr,"[ws] window ( 0x%x ) gravity: %d,%d\n",wsWindowList[l]->WindowID,Event->xgravity.x,Event->xgravity.y );
2851
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
646 // #endif
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4566
diff changeset
647 // break;
2851
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
648
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
649 case PropertyNotify:
2851
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
650 // break;
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
651 // #ifdef DEBUG
2045
deb4aff05c44 fix other bugs
pontscho
parents: 2030
diff changeset
652 // fprintf(stderr,"[ws] PropertyNotify ( 0x%x ) %s ( 0x%x )\n",wsWindowList[l]->WindowID,XGetAtomName( wsDisplay,Event->xproperty.atom ),Event->xproperty.atom );
2851
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
653 // #endif
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
654 if ( Event->xproperty.atom == wsWindowList[l]->AtomRemote )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
655 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
656 Atom type;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
657 int format;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
658 unsigned long nitems, bytesafter;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
659 unsigned char * args = NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
660
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
661 // fprintf( stderr,"[ws] remote property notify.\n" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
662 XGetWindowProperty( wsDisplay,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
663 Event->xproperty.window,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
664 Event->xproperty.atom,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
665 0,( 65536 / sizeof( long ) ),
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
666 False,XA_STRING,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
667 &type,&format,&nitems,&bytesafter,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
668 &args );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
669 if ( ( nitems )&&( wsWindowList[l]->RemoteHandler ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
670 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
671 args[strlen( args ) - 1]=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
672 wsWindowList[l]->RemoteHandler( args );
2851
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
673 #ifdef DEBUG
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
674 fprintf( stderr,"[ws] args: '%s'\n",args );
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
675 #endif
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
676 args[strlen( args ) - 1]=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
677 XFree( args );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
678 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
679 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
680 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
681
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
682 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
683 XFlush( wsDisplay );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
684 XSync( wsDisplay,False );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
685 return !wsTrue;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
686 // return True;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
687 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
688
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
689 Bool wsDummyEvents( Display * display,XEvent * Event,XPointer arg )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
690 { return True; }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
691
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4566
diff changeset
692 void wsHandleEvents( void ){
1709
a4e0211455d8 GUI integration, step 1
arpi
parents: 1701
diff changeset
693 // handle pending events
a4e0211455d8 GUI integration, step 1
arpi
parents: 1701
diff changeset
694 while ( XPending(wsDisplay) ){
a4e0211455d8 GUI integration, step 1
arpi
parents: 1701
diff changeset
695 XNextEvent( wsDisplay,&wsEvent );
a4e0211455d8 GUI integration, step 1
arpi
parents: 1701
diff changeset
696 // printf("### X event: %d [%d]\n",wsEvent.type,delay);
a4e0211455d8 GUI integration, step 1
arpi
parents: 1701
diff changeset
697 wsEvents( wsDisplay,&wsEvent,NULL );
a4e0211455d8 GUI integration, step 1
arpi
parents: 1701
diff changeset
698 }
a4e0211455d8 GUI integration, step 1
arpi
parents: 1701
diff changeset
699 }
a4e0211455d8 GUI integration, step 1
arpi
parents: 1701
diff changeset
700
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4566
diff changeset
701 extern void mplTimerHandler( void );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4566
diff changeset
702
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
703 void wsMainLoop( void )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
704 {
1699
7ddc63b84f1f DGA2 ifdefs, new mainloop/timer stuff
arpi
parents: 1693
diff changeset
705 int delay=20;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
706 fprintf( stderr,"[ws] init threads: %d\n",XInitThreads() );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
707 XSynchronize( wsDisplay,False );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
708 XLockDisplay( wsDisplay );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
709 // XIfEvent( wsDisplay,&wsEvent,wsEvents,NULL );
1699
7ddc63b84f1f DGA2 ifdefs, new mainloop/timer stuff
arpi
parents: 1693
diff changeset
710
7ddc63b84f1f DGA2 ifdefs, new mainloop/timer stuff
arpi
parents: 1693
diff changeset
711 #if 1
7ddc63b84f1f DGA2 ifdefs, new mainloop/timer stuff
arpi
parents: 1693
diff changeset
712
7ddc63b84f1f DGA2 ifdefs, new mainloop/timer stuff
arpi
parents: 1693
diff changeset
713 while(wsTrue){
7ddc63b84f1f DGA2 ifdefs, new mainloop/timer stuff
arpi
parents: 1693
diff changeset
714 // handle pending events
7ddc63b84f1f DGA2 ifdefs, new mainloop/timer stuff
arpi
parents: 1693
diff changeset
715 while ( XPending(wsDisplay) ){
7ddc63b84f1f DGA2 ifdefs, new mainloop/timer stuff
arpi
parents: 1693
diff changeset
716 XNextEvent( wsDisplay,&wsEvent );
1701
7955814db4c7 removed delay debug printf, better 'active delay'
arpi
parents: 1699
diff changeset
717 // printf("### X event: %d [%d]\n",wsEvent.type,delay);
1699
7ddc63b84f1f DGA2 ifdefs, new mainloop/timer stuff
arpi
parents: 1693
diff changeset
718 wsEvents( wsDisplay,&wsEvent,NULL );
1701
7955814db4c7 removed delay debug printf, better 'active delay'
arpi
parents: 1699
diff changeset
719 delay=0;
1699
7ddc63b84f1f DGA2 ifdefs, new mainloop/timer stuff
arpi
parents: 1693
diff changeset
720 }
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4566
diff changeset
721 mplTimerHandler(); // handle timer event
1699
7ddc63b84f1f DGA2 ifdefs, new mainloop/timer stuff
arpi
parents: 1693
diff changeset
722 usleep(delay*1000); // FIXME!
1701
7955814db4c7 removed delay debug printf, better 'active delay'
arpi
parents: 1699
diff changeset
723 if(delay<10*20) delay+=20; // pump up delay up to 0.2 sec (low activity)
1699
7ddc63b84f1f DGA2 ifdefs, new mainloop/timer stuff
arpi
parents: 1693
diff changeset
724 }
7ddc63b84f1f DGA2 ifdefs, new mainloop/timer stuff
arpi
parents: 1693
diff changeset
725
7ddc63b84f1f DGA2 ifdefs, new mainloop/timer stuff
arpi
parents: 1693
diff changeset
726 #else
7ddc63b84f1f DGA2 ifdefs, new mainloop/timer stuff
arpi
parents: 1693
diff changeset
727
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
728 while( wsTrue )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
729 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
730 XIfEvent( wsDisplay,&wsEvent,wsDummyEvents,NULL );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
731 wsEvents( wsDisplay,&wsEvent,NULL );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
732 }
1699
7ddc63b84f1f DGA2 ifdefs, new mainloop/timer stuff
arpi
parents: 1693
diff changeset
733 #endif
7ddc63b84f1f DGA2 ifdefs, new mainloop/timer stuff
arpi
parents: 1693
diff changeset
734
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
735 XUnlockDisplay( wsDisplay );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
736 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
737
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
738 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
739 // Switch to fullscreen.
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
740 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
741 void wsFullScreen( wsTWindow * win )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
742 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
743 int decoration = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
744 XUnmapWindow( wsDisplay,win->WindowID );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
745 win->SizeHint.flags=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
746 if ( win->isFullScreen )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
747 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
748 win->X=win->OldX;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
749 win->Y=win->OldY;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
750 win->Width=win->OldWidth;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
751 win->Height=win->OldHeight;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
752 win->isFullScreen=False;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
753 decoration=win->Decorations;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
754 wsScreenSaverOn( wsDisplay );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
755 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
756 else
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
757 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
758 win->OldX=win->X; win->OldY=win->Y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
759 win->OldWidth=win->Width; win->OldHeight=win->Height;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
760 win->X=0; win->Y=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
761 win->Width=wsMaxX; win->Height=wsMaxY;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
762 win->isFullScreen=True;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
763 wsScreenSaverOff( wsDisplay );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
764 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
765
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
766 win->SizeHint.flags|=PPosition | PSize;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
767 win->SizeHint.x=win->X;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
768 win->SizeHint.y=win->Y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
769 win->SizeHint.width=win->Width;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
770 win->SizeHint.height=win->Height;
1860
c65abbc91c5c fix mwm bug's. faszom (C), and remove mixer.*
pontscho
parents: 1858
diff changeset
771 if ( win->Property & wsMaxSize )
c65abbc91c5c fix mwm bug's. faszom (C), and remove mixer.*
pontscho
parents: 1858
diff changeset
772 {
c65abbc91c5c fix mwm bug's. faszom (C), and remove mixer.*
pontscho
parents: 1858
diff changeset
773 win->SizeHint.flags|=PMaxSize;
c65abbc91c5c fix mwm bug's. faszom (C), and remove mixer.*
pontscho
parents: 1858
diff changeset
774 win->SizeHint.max_width=win->Width;
c65abbc91c5c fix mwm bug's. faszom (C), and remove mixer.*
pontscho
parents: 1858
diff changeset
775 win->SizeHint.max_height=win->Height;
c65abbc91c5c fix mwm bug's. faszom (C), and remove mixer.*
pontscho
parents: 1858
diff changeset
776 }
c65abbc91c5c fix mwm bug's. faszom (C), and remove mixer.*
pontscho
parents: 1858
diff changeset
777 if ( win->Property & wsMinSize )
c65abbc91c5c fix mwm bug's. faszom (C), and remove mixer.*
pontscho
parents: 1858
diff changeset
778 {
c65abbc91c5c fix mwm bug's. faszom (C), and remove mixer.*
pontscho
parents: 1858
diff changeset
779 win->SizeHint.flags|=PMinSize;
c65abbc91c5c fix mwm bug's. faszom (C), and remove mixer.*
pontscho
parents: 1858
diff changeset
780 win->SizeHint.min_width=win->Width;
c65abbc91c5c fix mwm bug's. faszom (C), and remove mixer.*
pontscho
parents: 1858
diff changeset
781 win->SizeHint.min_height=win->Height;
c65abbc91c5c fix mwm bug's. faszom (C), and remove mixer.*
pontscho
parents: 1858
diff changeset
782 }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
783 XSetWMNormalHints( wsDisplay,win->WindowID,&win->SizeHint );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
784
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
785 XMoveResizeWindow( wsDisplay,win->WindowID,win->X,win->Y,win->Width,win->Height );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
786 wsWindowDecoration( win,decoration );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
787 XRaiseWindow( wsDisplay,win->WindowID );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
788 XMapWindow( wsDisplay,win->WindowID );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
789 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
790
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
791 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
792 // Redraw screen.
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
793 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
794 void wsPostRedisplay( wsTWindow * win )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
795 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
796 if ( win->ReDraw )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
797 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
798 win->ReDraw( wsDisplay,win->WindowID );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
799 XFlush( wsDisplay );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
800 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
801 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
802
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
803 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
804 // Do Exit.
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
805 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
806 void wsDoExit( void )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
807 { wsTrue=False; wsResizeWindow( wsWindowList[0],32,32 ); }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
808
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
809 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
810 // Put 'Image' to window.
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
811 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
812 void wsConvert( wsTWindow * win,unsigned char * Image,unsigned int Size )
2733
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
813 { if ( wsConvFunc ) wsConvFunc( Image,win->ImageData,win->xImage->width * win->xImage->height * 4 ); }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
814
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
815 void wsPutImage( wsTWindow * win )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
816 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
817 if ( wsUseXShm )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
818 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
819 XShmPutImage( wsDisplay,win->WindowID,win->wGC,win->xImage,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
820 0,0,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
821 ( win->Width - win->xImage->width ) / 2,( win->Height - win->xImage->height ) / 2,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
822 win->xImage->width,win->xImage->height,0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
823 // win->Width,win->Height,0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
824 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
825 else
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
826 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
827 XPutImage( wsDisplay,win->WindowID,win->wGC,win->xImage,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
828 0,0,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
829 ( win->Width - win->xImage->width ) / 2,( win->Height - win->xImage->height ) / 2,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
830 win->xImage->width,win->xImage->height );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
831 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
832 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
833
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
834 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
835 // Move window to x, y.
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
836 // ----------------------------------------------------------------------------------------------
2854
fd44ecf77f8d move bug meg fileload bug fixed asszem.
pontscho
parents: 2851
diff changeset
837 void wsMoveWindow( wsTWindow * win,int b,int x, int y )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
838 {
2854
fd44ecf77f8d move bug meg fileload bug fixed asszem.
pontscho
parents: 2851
diff changeset
839 if ( b )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
840 {
2854
fd44ecf77f8d move bug meg fileload bug fixed asszem.
pontscho
parents: 2851
diff changeset
841 switch ( x )
fd44ecf77f8d move bug meg fileload bug fixed asszem.
pontscho
parents: 2851
diff changeset
842 {
fd44ecf77f8d move bug meg fileload bug fixed asszem.
pontscho
parents: 2851
diff changeset
843 case -1: win->X=( wsMaxX / 2 ) - ( win->Width / 2 ); break;
fd44ecf77f8d move bug meg fileload bug fixed asszem.
pontscho
parents: 2851
diff changeset
844 case -2: win->X=wsMaxX - win->Width; break;
fd44ecf77f8d move bug meg fileload bug fixed asszem.
pontscho
parents: 2851
diff changeset
845 default: win->X=x; break;
fd44ecf77f8d move bug meg fileload bug fixed asszem.
pontscho
parents: 2851
diff changeset
846 }
fd44ecf77f8d move bug meg fileload bug fixed asszem.
pontscho
parents: 2851
diff changeset
847 switch ( y )
fd44ecf77f8d move bug meg fileload bug fixed asszem.
pontscho
parents: 2851
diff changeset
848 {
fd44ecf77f8d move bug meg fileload bug fixed asszem.
pontscho
parents: 2851
diff changeset
849 case -1: win->Y=( wsMaxY / 2 ) - ( win->Height / 2 ); break;
fd44ecf77f8d move bug meg fileload bug fixed asszem.
pontscho
parents: 2851
diff changeset
850 case -2: win->Y=wsMaxY - win->Height; break;
fd44ecf77f8d move bug meg fileload bug fixed asszem.
pontscho
parents: 2851
diff changeset
851 default: win->Y=y; break;
fd44ecf77f8d move bug meg fileload bug fixed asszem.
pontscho
parents: 2851
diff changeset
852 }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
853 }
2854
fd44ecf77f8d move bug meg fileload bug fixed asszem.
pontscho
parents: 2851
diff changeset
854 else { win->X=x; win->Y=y; }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
855
2851
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
856 win->SizeHint.flags=PPosition | PWinGravity;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
857 win->SizeHint.x=win->X;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
858 win->SizeHint.y=win->Y;
2851
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
859 win->SizeHint.win_gravity=StaticGravity;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
860 XSetWMNormalHints( wsDisplay,win->WindowID,&win->SizeHint );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
861
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
862 XMoveWindow( wsDisplay,win->WindowID,win->X,win->Y );
1810
d44b0ce32791 fix move&resize
pontscho
parents: 1782
diff changeset
863 if ( win->ReSize ) win->ReSize( win->X,win->Y,win->Width,win->Height );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
864 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
865
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
866 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
867 // Resize window to sx, sy.
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
868 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
869 void wsResizeWindow( wsTWindow * win,int sx, int sy )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
870 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
871 win->Width=sx;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
872 win->Height=sy;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
873
2851
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
874 win->SizeHint.flags=PSize | PWinGravity;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
875 win->SizeHint.width=win->Width;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
876 win->SizeHint.height=win->Height;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
877 if ( win->Property & wsMinSize )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
878 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
879 win->SizeHint.flags|=PMinSize;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
880 win->SizeHint.min_width=win->Width;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
881 win->SizeHint.min_height=win->Height;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
882 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
883 if ( win->Property & wsMaxSize )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
884 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
885 win->SizeHint.flags|=PMaxSize;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
886 win->SizeHint.max_width=win->Width;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
887 win->SizeHint.max_height=win->Height;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
888 }
2851
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
889 win->SizeHint.win_gravity=StaticGravity;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
890 XSetWMNormalHints( wsDisplay,win->WindowID,&win->SizeHint );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
891 XResizeWindow( wsDisplay,win->WindowID,sx,sy );
1810
d44b0ce32791 fix move&resize
pontscho
parents: 1782
diff changeset
892 if ( win->ReSize ) win->ReSize( win->X,win->Y,win->Width,win->Height );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
893 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
894
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
895 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
896 // Iconify window.
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
897 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
898 void wsIconify( wsTWindow win )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
899 { XIconifyWindow( wsDisplay,win.WindowID,0 ); }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
900
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
901 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
902 // Move top the window.
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
903 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
904 void wsMoveTopWindow( wsTWindow * win )
2851
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
905 {
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
906 // XUnmapWindow( wsDisplay,win->WindowID ); XMapWindow( wsDisplay,win->WindowID );
b64fa5d25142 add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents: 2782
diff changeset
907 XRaiseWindow( wsDisplay,win->WindowID );
2045
deb4aff05c44 fix other bugs
pontscho
parents: 2030
diff changeset
908 }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
909
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
910 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
911 // Set window background to 'color'.
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
912 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
913 void wsSetBackground( wsTWindow * win,int color )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
914 { XSetWindowBackground( wsDisplay,win->WindowID,color ); }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
915
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
916 void wsSetBackgroundRGB( wsTWindow * win,int r,int g,int b )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
917 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
918 int color = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
919 switch ( wsOutMask )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
920 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
921 case wsRGB32:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
922 case wsRGB24: color=( r << 16 ) + ( g << 8 ) + b; break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
923 case wsBGR32:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
924 case wsBGR24: color=( b << 16 ) + ( g << 8 ) + r; break;
2733
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
925 case wsRGB16: PACK_RGB16( b,g,r,color ); break;
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
926 case wsBGR16: PACK_RGB16( r,g,b,color ); break;
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
927 case wsRGB15: PACK_RGB15( b,g,r,color ); break;
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
928 case wsBGR15: PACK_RGB15( r,g,b,color ); break;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
929 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
930 XSetWindowBackground( wsDisplay,win->WindowID,color );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
931 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
932
1814
9c674dc76ff3 add wsSetForegroundRGB
pontscho
parents: 1810
diff changeset
933 void wsSetForegroundRGB( wsTWindow * win,int r,int g,int b )
9c674dc76ff3 add wsSetForegroundRGB
pontscho
parents: 1810
diff changeset
934 {
9c674dc76ff3 add wsSetForegroundRGB
pontscho
parents: 1810
diff changeset
935 int color = 0;
9c674dc76ff3 add wsSetForegroundRGB
pontscho
parents: 1810
diff changeset
936 switch ( wsOutMask )
9c674dc76ff3 add wsSetForegroundRGB
pontscho
parents: 1810
diff changeset
937 {
9c674dc76ff3 add wsSetForegroundRGB
pontscho
parents: 1810
diff changeset
938 case wsRGB32:
9c674dc76ff3 add wsSetForegroundRGB
pontscho
parents: 1810
diff changeset
939 case wsRGB24: color=( r << 16 ) + ( g << 8 ) + b; break;
9c674dc76ff3 add wsSetForegroundRGB
pontscho
parents: 1810
diff changeset
940 case wsBGR32:
9c674dc76ff3 add wsSetForegroundRGB
pontscho
parents: 1810
diff changeset
941 case wsBGR24: color=( b << 16 ) + ( g << 8 ) + r; break;
2733
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
942 case wsRGB16: PACK_RGB16( b,g,r,color ); break;
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
943 case wsBGR16: PACK_RGB16( r,g,b,color ); break;
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
944 case wsRGB15: PACK_RGB15( b,g,r,color ); break;
4dddb055d2cd add prostproc/rgb2rgb
pontscho
parents: 2476
diff changeset
945 case wsBGR15: PACK_RGB15( r,g,b,color ); break;
1814
9c674dc76ff3 add wsSetForegroundRGB
pontscho
parents: 1810
diff changeset
946 }
9c674dc76ff3 add wsSetForegroundRGB
pontscho
parents: 1810
diff changeset
947 XSetForeground( wsDisplay,win->wGC,color );
9c674dc76ff3 add wsSetForegroundRGB
pontscho
parents: 1810
diff changeset
948 }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
949
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
950 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
951 // Draw string at x,y with fc ( foreground color ) and bc ( background color ).
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
952 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
953 void wsDrawString( wsTWindow win,int x,int y,char * str,int fc,int bc )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
954 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
955 XSetForeground( wsDisplay,win.wGC,bc );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
956 XFillRectangle( wsDisplay,win.WindowID,win.wGC,x,y,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
957 XTextWidth( win.Font,str,strlen( str ) ) + 20,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
958 win.FontHeight + 2 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
959 XSetForeground( wsDisplay,win.wGC,fc );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
960 XDrawString( wsDisplay,win.WindowID,win.wGC,x + 10,y + 13,str,strlen( str ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
961 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
962
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
963 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
964 // Calculation string width.
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
965 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
966 int wsTextWidth( wsTWindow win,char * str )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
967 { return XTextWidth( win.Font,str,strlen( str ) ) + 20; }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
968
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
969 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
970 // Show / hide mouse cursor.
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
971 // ----------------------------------------------------------------------------------------------
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
972 void wsVisibleMouse( wsTWindow * win,int m )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
973 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
974 switch ( m )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
975 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
976 case wsShowMouseCursor:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
977 if ( win->wsCursor != None )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
978 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
979 XFreeCursor( wsDisplay,win->wsCursor );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
980 win->wsCursor=None;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
981 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
982 XDefineCursor( wsDisplay,win->WindowID,0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
983 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
984 case wsHideMouseCursor:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
985 win->wsCursor=XCreatePixmapCursor( wsDisplay,win->wsCursorPixmap,win->wsCursorPixmap,&win->wsColor,&win->wsColor,0,0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
986 XDefineCursor( wsDisplay,win->WindowID,win->wsCursor );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
987 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
988 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
989 XFlush( wsDisplay );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
990 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
991
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
992 int wsGetDepthOnScreen( void )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
993 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
994 int bpp,ibpp;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
995 XImage * mXImage;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
996 XWindowAttributes attribs;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
997
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
998 mXImage=XGetImage( wsDisplay,wsRootWin,0,0,1,1,AllPlanes,ZPixmap );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
999 bpp=mXImage->bits_per_pixel;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1000
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1001 XGetWindowAttributes( wsDisplay,wsRootWin,&attribs );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1002 ibpp=attribs.depth;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1003 mXImage=XGetImage( wsDisplay,wsRootWin,0,0,1,1,AllPlanes,ZPixmap );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1004 bpp=mXImage->bits_per_pixel;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1005 if ( ( ibpp + 7 ) / 8 != ( bpp + 7 ) / 8 ) ibpp=bpp;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1006 wsDepthOnScreen=ibpp;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1007 wsRedMask=mXImage->red_mask;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1008 wsGreenMask=mXImage->green_mask;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1009 wsBlueMask=mXImage->blue_mask;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1010 XDestroyImage( mXImage );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1011 return ibpp;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1012 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1013
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1014 void wsXDone( void )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1015 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1016 XCloseDisplay( wsDisplay );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1017 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1018
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1019 void wsVisibleWindow( wsTWindow * win,int show )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1020 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1021 switch( show )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1022 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1023 case wsShowWindow: XMapWindow( wsDisplay,win->WindowID ); break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1024 case wsHideWindow: XUnmapWindow( wsDisplay,win->WindowID ); break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1025 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1026 XFlush( wsDisplay );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1027 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1028
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1029 void wsDestroyImage( wsTWindow * win )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1030 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1031 if ( win->xImage )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1032 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1033 XDestroyImage( win->xImage );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1034 if ( wsUseXShm )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1035 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1036 XShmDetach( wsDisplay,&win->Shminfo );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1037 shmdt( win->Shminfo.shmaddr );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1038 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1039 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1040 win->xImage=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1041 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1042
1858
88a88d0a3f94 fix skin changing, xv fullscreen redraw bug, etc.
pontscho
parents: 1853
diff changeset
1043 void wsCreateImage( wsTWindow * win,int Width,int Height )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1044 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1045 int CompletionType = -1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1046 if ( wsUseXShm )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1047 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1048 CompletionType=XShmGetEventBase( wsDisplay ) + ShmCompletion;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1049 win->xImage=XShmCreateImage( wsDisplay,win->VisualInfo.visual,
1858
88a88d0a3f94 fix skin changing, xv fullscreen redraw bug, etc.
pontscho
parents: 1853
diff changeset
1050 win->Attribs.depth,ZPixmap,NULL,&win->Shminfo,Width,Height );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1051 if ( win->xImage == NULL )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1052 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1053 fprintf( stderr,"[ws] shared memory extension error.\n" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1054 exit( 0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1055 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1056 // #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1057 // fprintf( stderr,"[ws] Screen depth: %d\n",win->xImage->bits_per_pixel );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1058 // #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1059 win->Shminfo.shmid=shmget( IPC_PRIVATE,win->xImage->bytes_per_line * win->xImage->height,IPC_CREAT|0777 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1060 if ( win->Shminfo.shmid < 0 )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1061 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1062 XDestroyImage( win->xImage );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1063 fprintf( stderr,"[ws] shared memory extension error.\n" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1064 exit( 0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1065 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1066 win->Shminfo.shmaddr=(char *)shmat( win->Shminfo.shmid,0,0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1067
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1068 if ( win->Shminfo.shmaddr == ((char *) -1) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1069 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1070 XDestroyImage( win->xImage );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1071 if ( win->Shminfo.shmaddr != ((char *) -1) ) shmdt( win->Shminfo.shmaddr );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1072 fprintf( stderr,"[ws] shared memory extension error.\n" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1073 exit( 0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1074 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1075 win->xImage->data=win->Shminfo.shmaddr;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1076 win->Shminfo.readOnly=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1077 XShmAttach( wsDisplay,&win->Shminfo );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1078 shmctl( win->Shminfo.shmid,IPC_RMID,0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1079 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1080 else
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1081 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1082 win->xImage=XCreateImage( wsDisplay,win->VisualInfo.visual,win->Attribs.depth,
1858
88a88d0a3f94 fix skin changing, xv fullscreen redraw bug, etc.
pontscho
parents: 1853
diff changeset
1083 ZPixmap,0,0,Width,Height,
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1084 (wsDepthOnScreen == 3) ? 32 : wsDepthOnScreen,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1085 0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1086 if ( ( win->xImage->data=malloc( win->xImage->bytes_per_line * win->xImage->height ) ) == NULL )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1087 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1088 fprintf( stderr,"[ws] sorry, not enough memory for draw buffer.\n" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1089 exit( 0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1090 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1091 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1092 win->ImageData=(unsigned char *)win->xImage->data;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1093 win->ImageDataw=(unsigned short int *)win->xImage->data;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1094 win->ImageDatadw=(unsigned int *)win->xImage->data;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1095 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1096
1858
88a88d0a3f94 fix skin changing, xv fullscreen redraw bug, etc.
pontscho
parents: 1853
diff changeset
1097 void wsResizeImage( wsTWindow * win,int Width,int Height )
88a88d0a3f94 fix skin changing, xv fullscreen redraw bug, etc.
pontscho
parents: 1853
diff changeset
1098 { wsDestroyImage( win ); wsCreateImage( win,Width,Height ); }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1099
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1100 int wsGetOutMask( void )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1101 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1102 if ( ( wsDepthOnScreen == 32 )&&( wsRedMask == 0xff0000 )&&( wsGreenMask == 0x00ff00 )&&( wsBlueMask == 0x0000ff ) ) return wsRGB32;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1103 if ( ( wsDepthOnScreen == 32 )&&( wsRedMask == 0x0000ff )&&( wsGreenMask == 0x00ff00 )&&( wsBlueMask == 0xff0000 ) ) return wsBGR32;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1104 if ( ( wsDepthOnScreen == 24 )&&( wsRedMask == 0xff0000 )&&( wsGreenMask == 0x00ff00 )&&( wsBlueMask == 0x0000ff ) ) return wsRGB24;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1105 if ( ( wsDepthOnScreen == 24 )&&( wsRedMask == 0x0000ff )&&( wsGreenMask == 0x00ff00 )&&( wsBlueMask == 0xff0000 ) ) return wsBGR24;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1106 if ( ( wsDepthOnScreen == 16 )&&( wsRedMask == 0xf800 )&&( wsGreenMask == 0x7e0 )&&( wsBlueMask == 0x1f ) ) return wsRGB16;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1107 if ( ( wsDepthOnScreen == 16 )&&( wsRedMask == 0x1f )&&( wsGreenMask == 0x7e0 )&&( wsBlueMask == 0xf800 ) ) return wsBGR16;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1108 if ( ( wsDepthOnScreen == 15 )&&( wsRedMask == 0x7c00 )&&( wsGreenMask == 0x3e0 )&&( wsBlueMask == 0x1f ) ) return wsRGB15;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1109 if ( ( wsDepthOnScreen == 15 )&&( wsRedMask == 0x1f )&&( wsGreenMask == 0x3e0 )&&( wsBlueMask == 0x7c00 ) ) return wsBGR15;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1110 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1111 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1112
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1113 void wsSetTitle( wsTWindow * win,char * name )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1114 { XStoreName( wsDisplay,win->WindowID,name ); }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1115
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1116 void wsSetMousePosition( wsTWindow * win,int x, int y )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1117 { XWarpPointer( wsDisplay,wsRootWin,win->WindowID,0,0,0,0,x,y ); }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1118
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1119 static int dpms_disabled=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1120 static int timeout_save=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1121
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1122 void wsScreenSaverOn( Display *mDisplay )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1123 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1124 int nothing;
4566
3b1721b9e211 fix dpsm compile bug in gui
pontscho
parents: 4465
diff changeset
1125 #ifdef HAVE_XDPMS
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1126 if ( dpms_disabled )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1127 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1128 if ( DPMSQueryExtension( mDisplay,&nothing,&nothing ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1129 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1130 if ( !DPMSEnable( mDisplay ) ) fprintf( stderr,"DPMS not available ?\n" ); // restoring power saving settings
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1131 else
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1132 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1133 // DPMS does not seem to be enabled unless we call DPMSInfo
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1134 BOOL onoff;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1135 CARD16 state;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1136 DPMSInfo( mDisplay,&state,&onoff );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1137 if ( onoff ) fprintf( stderr,"Successfully enabled DPMS.\n" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1138 else fprintf( stderr,"Could not enable DPMS.\n" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1139 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1140 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1141 }
4566
3b1721b9e211 fix dpsm compile bug in gui
pontscho
parents: 4465
diff changeset
1142 #endif
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1143 if ( timeout_save )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1144 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1145 int dummy, interval, prefer_blank, allow_exp;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1146 XGetScreenSaver( mDisplay,&dummy,&interval,&prefer_blank,&allow_exp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1147 XSetScreenSaver( mDisplay,timeout_save,interval,prefer_blank,allow_exp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1148 XGetScreenSaver( mDisplay,&timeout_save,&interval,&prefer_blank,&allow_exp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1149 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1150 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1151
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1152 void wsScreenSaverOff( Display * mDisplay )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1153 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1154 int interval,prefer_blank,allow_exp,nothing;
4566
3b1721b9e211 fix dpsm compile bug in gui
pontscho
parents: 4465
diff changeset
1155 #ifdef HAVE_XDPMS
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1156 if ( DPMSQueryExtension( mDisplay,&nothing,&nothing ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1157 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1158 BOOL onoff;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1159 CARD16 state;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1160 DPMSInfo( mDisplay,&state,&onoff );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1161 if ( onoff )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1162 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1163 Status stat;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1164 fprintf( stderr,"Disabling DPMS.\n" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1165 dpms_disabled=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1166 stat=DPMSDisable( mDisplay ); // monitor powersave off
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1167 fprintf( stderr,"stat: %d.\n",stat );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1168 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1169 }
4566
3b1721b9e211 fix dpsm compile bug in gui
pontscho
parents: 4465
diff changeset
1170 #endif
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1171 XGetScreenSaver( mDisplay,&timeout_save,&interval,&prefer_blank,&allow_exp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1172 if ( timeout_save ) XSetScreenSaver( mDisplay,0,interval,prefer_blank,allow_exp ); // turning off screensaver
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1173 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1174
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1175 void wsSetShape( wsTWindow * win,char * data )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1176 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1177 #ifdef HAVE_XSHAPE
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1850
diff changeset
1178 if ( !wsUseXShape ) return;
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1850
diff changeset
1179 if ( data )
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1850
diff changeset
1180 {
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1850
diff changeset
1181 win->Mask=XCreateBitmapFromData( wsDisplay,win->WindowID,data,win->Width,win->Height );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1850
diff changeset
1182 XShapeCombineMask( wsDisplay,win->WindowID,ShapeBounding,0,0,win->Mask,ShapeSet );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1850
diff changeset
1183 XFreePixmap( wsDisplay,win->Mask );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1850
diff changeset
1184 }
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1850
diff changeset
1185 else XShapeCombineMask( wsDisplay,win->WindowID,ShapeBounding,0,0,None,ShapeSet );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1186 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1187 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1188
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1189 #include "wsmkeys.h"