annotate Gui/wm/ws.c @ 6965:f8ea0af8edb0

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