annotate libvo/x11_common.c @ 1154:4bf4e057c82e

- if DGA fails to report some valid modes, vo_dga now exits gracefully instead of crashing ... (100000x100000 bug ...)
author acki2
date Sun, 17 Jun 2001 22:21:47 +0000
parents 4c7b219e126c
children ebe9659da559
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
448
198b46b739d8 qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents: 440
diff changeset
1
32
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
2 #include <stdio.h>
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
3 #include <stdlib.h>
448
198b46b739d8 qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents: 440
diff changeset
4
198b46b739d8 qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents: 440
diff changeset
5 #include "config.h"
198b46b739d8 qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents: 440
diff changeset
6
198b46b739d8 qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents: 440
diff changeset
7 #ifdef X11_FULLSCREEN
198b46b739d8 qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents: 440
diff changeset
8
440
d19a3da6ac13 Pontscho's mixer, select, and hell-a-lot-of-stuff patch ;)
gabucino
parents: 416
diff changeset
9 #include <string.h>
32
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
10 #include <unistd.h>
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
11 #include <sys/mman.h>
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
12
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
13 #include "video_out.h"
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
14
324
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
15 #include <X11/Xmd.h>
32
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
16 #include <X11/Xlib.h>
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
17 #include <X11/Xutil.h>
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
18 #include <X11/Xatom.h>
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
19
448
198b46b739d8 qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents: 440
diff changeset
20 #include <X11/extensions/dpms.h>
198b46b739d8 qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents: 440
diff changeset
21
324
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
22 static int dpms_disabled=0;
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
23 static int timeout_save=0;
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
24
922
db06ae8967eb Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents: 741
diff changeset
25 char* mDisplayName=NULL;
db06ae8967eb Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents: 741
diff changeset
26 Display* mDisplay;
db06ae8967eb Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents: 741
diff changeset
27 Window mRootWin;
db06ae8967eb Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents: 741
diff changeset
28 int mScreen;
db06ae8967eb Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents: 741
diff changeset
29 int mLocalDisplay;
db06ae8967eb Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents: 741
diff changeset
30
384
b0e4e5744899 Autohide X11 cursor
lgb
parents: 369
diff changeset
31
b0e4e5744899 Autohide X11 cursor
lgb
parents: 369
diff changeset
32 void vo_hidecursor ( Display *disp , Window win )
b0e4e5744899 Autohide X11 cursor
lgb
parents: 369
diff changeset
33 {
458
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
34 Cursor no_ptr;
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
35 Pixmap bm_no;
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
36 XColor black,dummy;
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
37 Colormap colormap;
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
38 static unsigned char bm_no_data[] = { 0,0,0,0, 0,0,0,0 };
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
39
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
40 colormap = DefaultColormap(disp,DefaultScreen(disp));
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
41 XAllocNamedColor(disp,colormap,"black",&black,&dummy);
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
42 bm_no = XCreateBitmapFromData(disp, win, bm_no_data, 8,8);
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
43 no_ptr=XCreatePixmapCursor(disp, bm_no, bm_no,&black, &black,0, 0);
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
44 XDefineCursor(disp,win,no_ptr);
384
b0e4e5744899 Autohide X11 cursor
lgb
parents: 369
diff changeset
45 }
b0e4e5744899 Autohide X11 cursor
lgb
parents: 369
diff changeset
46
b0e4e5744899 Autohide X11 cursor
lgb
parents: 369
diff changeset
47
32
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
48 int vo_init( void )
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
49 {
922
db06ae8967eb Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents: 741
diff changeset
50 // int mScreen;
32
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
51 int bpp;
1137
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
52 unsigned int mask;
922
db06ae8967eb Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents: 741
diff changeset
53 // char * DisplayName = ":0.0";
db06ae8967eb Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents: 741
diff changeset
54 // Display * mDisplay;
32
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
55 XImage * mXImage;
922
db06ae8967eb Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents: 741
diff changeset
56 // Window mRootWin;
32
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
57 static XWindowAttributes attribs;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
58
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
59 if(vo_depthonscreen) return 1; // already called
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
60
922
db06ae8967eb Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents: 741
diff changeset
61 if (!mDisplayName)
db06ae8967eb Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents: 741
diff changeset
62 if (!(mDisplayName=getenv("DISPLAY")))
db06ae8967eb Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents: 741
diff changeset
63 mDisplayName=strdup(":0.0");
db06ae8967eb Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents: 741
diff changeset
64
db06ae8967eb Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents: 741
diff changeset
65 mDisplay=XOpenDisplay(mDisplayName);
32
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
66 if ( !mDisplay )
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
67 {
922
db06ae8967eb Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents: 741
diff changeset
68 printf( "vo: couldn't open the X11 display (%s)!\n",mDisplayName );
32
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
69 return 0;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
70 }
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
71 mScreen=DefaultScreen( mDisplay ); // Screen ID.
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
72 mRootWin=RootWindow( mDisplay,mScreen );// Root window ID.
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
73 vo_screenwidth=DisplayWidth( mDisplay,mScreen );
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
74 vo_screenheight=DisplayHeight( mDisplay,mScreen );
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
75 // get color depth:
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
76 // XGetWindowAttributes(mydisplay, DefaultRootWindow(mDisplay), &attribs);
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
77 XGetWindowAttributes(mDisplay, mRootWin, &attribs);
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
78 vo_depthonscreen=attribs.depth;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
79 // get bits/pixel:
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
80 mXImage=XGetImage( mDisplay,mRootWin,0,0,1,1,AllPlanes,ZPixmap );
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
81 bpp=mXImage->bits_per_pixel;
1137
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
82 if((vo_depthonscreen+7)/8 != (bpp+7)/8) vo_depthonscreen=bpp; // by A'rpi
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
83 mask=mXImage->red_mask|mXImage->green_mask|mXImage->blue_mask;
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
84 printf("vo: X11 color mask: %X (R:%lX G:%lX B:%lX)\n",
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
85 mask,mXImage->red_mask,mXImage->green_mask,mXImage->blue_mask);
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
86 if(((vo_depthonscreen+7)/8)==2){
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
87 if(mask==0x7FFF) vo_depthonscreen=15; else
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
88 if(mask==0xFFFF) vo_depthonscreen=16;
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
89 }
32
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
90 XDestroyImage( mXImage );
922
db06ae8967eb Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents: 741
diff changeset
91 // XCloseDisplay( mDisplay );
db06ae8967eb Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents: 741
diff changeset
92 #warning Better local display detection method is needed.
db06ae8967eb Centralized and cleaned up X11 connecting, fixed remote X11 playing, -display option for mplayer. SHOULD BE TESTED.
lgb
parents: 741
diff changeset
93 if (*mDisplayName==':') mLocalDisplay=1; else mLocalDisplay=0;
1137
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
94 printf("vo: X11 running at %dx%d depth: %d (\"%s\" => %s display)\n",vo_screenwidth,vo_screenheight,vo_depthonscreen,mDisplayName,mLocalDisplay?"local":"remote");
32
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
95 return 1;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
96 }
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
97
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
98 #include "../linux/keycodes.h"
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
99 #include "wskeys.h"
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
100
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
101 extern void mplayer_put_key(int code);
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
102
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
103 void vo_x11_putkey(int key){
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
104 switch ( key )
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
105 {
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
106 case wsLeft: mplayer_put_key(KEY_LEFT); break;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
107 case wsRight: mplayer_put_key(KEY_RIGHT); break;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
108 case wsUp: mplayer_put_key(KEY_UP); break;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
109 case wsDown: mplayer_put_key(KEY_DOWN); break;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
110 case wsSpace: mplayer_put_key(' '); break;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
111 case wsEscape: mplayer_put_key(KEY_ESC); break;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
112 case wsEnter: mplayer_put_key(KEY_ENTER); break;
651
617ae66624b3 -ss patch by Loring Holden
arpi_esp
parents: 614
diff changeset
113 case wsPageUp: mplayer_put_key(KEY_PAGE_UP); break;
617ae66624b3 -ss patch by Loring Holden
arpi_esp
parents: 614
diff changeset
114 case wsPageDown: mplayer_put_key(KEY_PAGE_DOWN); break;
32
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
115 case wsq:
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
116 case wsQ: mplayer_put_key('q'); break;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
117 case wsp:
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
118 case wsP: mplayer_put_key('p'); break;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
119 case wsMinus:
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
120 case wsGrayMinus: mplayer_put_key('-'); break;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
121 case wsPlus:
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
122 case wsGrayPlus: mplayer_put_key('+'); break;
464
edea605a4a5d add mixer support
pontscho
parents: 458
diff changeset
123 case wsGrayMul:
edea605a4a5d add mixer support
pontscho
parents: 458
diff changeset
124 case wsMul: mplayer_put_key('*'); break;
edea605a4a5d add mixer support
pontscho
parents: 458
diff changeset
125 case wsGrayDiv:
edea605a4a5d add mixer support
pontscho
parents: 458
diff changeset
126 case wsDiv: mplayer_put_key('/'); break;
516
bdca96b27ceb add 'mixer support
pontscho
parents: 464
diff changeset
127 case wsm:
bdca96b27ceb add 'mixer support
pontscho
parents: 464
diff changeset
128 case wsM: mplayer_put_key('m'); break;
655
0bdfd4dc95f2 add o key
pontscho
parents: 651
diff changeset
129 case wso:
0bdfd4dc95f2 add o key
pontscho
parents: 651
diff changeset
130 case wsO: mplayer_put_key('o'); break;
369
b1a706452eeb pass keys a-z && A-Z
arpi_esp
parents: 326
diff changeset
131 default: if((key>='a' && key<='z')||(key>='A' && key<='Z')) mplayer_put_key(key);
32
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
132 }
369
b1a706452eeb pass keys a-z && A-Z
arpi_esp
parents: 326
diff changeset
133
32
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
134 }
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
135
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
136
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
137 // ----- Motif header: -------
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
138
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
139 #define MWM_HINTS_DECORATIONS 2
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
140
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
141 typedef struct
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
142 {
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
143 long flags;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
144 long functions;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
145 long decorations;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
146 long input_mode;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
147 } MotifWmHints;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
148
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
149 extern MotifWmHints vo_MotifWmHints;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
150 extern Atom vo_MotifHints;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
151 extern int vo_depthonscreen;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
152 extern int vo_screenwidth;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
153 extern int vo_screenheight;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
154
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
155 static MotifWmHints vo_MotifWmHints;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
156 static Atom vo_MotifHints = None;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
157
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
158 void vo_x11_decoration( Display * vo_Display,Window w,int d )
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
159 {
1137
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
160
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
161 #if 1
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
162 XSetWindowAttributes attr;
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
163 attr.override_redirect = True;
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
164 XChangeWindowAttributes(vo_Display, w, CWOverrideRedirect, &attr);
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
165 // XMapWindow(vo_Display], w);
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
166 #endif
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
167
32
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
168 vo_MotifHints=XInternAtom( vo_Display,"_MOTIF_WM_HINTS",0 );
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
169 if ( vo_MotifHints != None )
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
170 {
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
171 vo_MotifWmHints.flags=2;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
172 vo_MotifWmHints.decorations=d;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
173 XChangeProperty( vo_Display,w,vo_MotifHints,vo_MotifHints,32,
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
174 PropModeReplace,(unsigned char *)&vo_MotifWmHints,4 );
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
175 }
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
176 }
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
177
1137
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
178 void vo_x11_classhint( Display * display,Window window,char *name ){
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
179 XClassHint wmClass;
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
180 wmClass.res_name = name;
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
181 wmClass.res_class = "MPlayer";
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
182 XSetClassHint(display,window,&wmClass);
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
183 }
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
184
723
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
185 #ifdef HAVE_GUI
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
186 Window vo_window = None;
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
187 GC vo_gc;
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
188 int vo_xeventhandling = 1;
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
189 int vo_resize = 0;
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
190 int vo_expose = 0;
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
191
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
192 void vo_setwindow( Window w,GC g )
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
193 { vo_window=w; vo_gc=g; }
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
194 #endif
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
195
32
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
196 int vo_x11_check_events(Display *mydisplay){
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
197 int ret=0;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
198 XEvent Event;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
199 char buf[100];
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
200 KeySym keySym;
1038
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents: 922
diff changeset
201 static XComposeStatus stat;
32
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
202 // unsigned long vo_KeyTable[512];
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
203
723
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
204 #ifdef HAVE_GUI
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
205 if ( vo_xeventhandling )
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
206 {
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
207 #endif
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
208 while ( XPending( mydisplay ) )
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
209 {
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
210 XNextEvent( mydisplay,&Event );
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
211 switch( Event.type )
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
212 {
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
213 case Expose:
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
214 ret|=VO_EVENT_EXPOSE;
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
215 break;
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
216 case ConfigureNotify:
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
217 vo_dwidth=Event.xconfigure.width;
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
218 vo_dheight=Event.xconfigure.height;
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
219 ret|=VO_EVENT_RESIZE;
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
220 break;
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
221 case KeyPress:
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
222 XLookupString( &Event.xkey,buf,sizeof(buf),&keySym,&stat );
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
223 vo_x11_putkey( ( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) ) );
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
224 ret|=VO_EVENT_KEYPRESS;
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
225 break;
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
226 }
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
227 }
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
228 #ifdef HAVE_GUI
32
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
229 }
723
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
230 else
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
231 {
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
232 if ( vo_resize )
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
233 {
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
234 vo_resize=0;
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
235 ret|=VO_EVENT_RESIZE;
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
236 }
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
237 if ( vo_expose )
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
238 {
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
239 vo_expose=0;
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
240 ret|=VO_EVENT_EXPOSE;
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
241 }
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
242 }
c3e0bdb64027 add gui support
pontscho
parents: 655
diff changeset
243 #endif
32
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
244
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
245 return ret;
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
246 }
9e66f722790e the common x11 stuff
arpi_esp
parents:
diff changeset
247
324
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
248 void saver_on(Display *mDisplay) {
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
249
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
250 int nothing;
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
251 if (dpms_disabled)
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
252 {
458
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
253 if (DPMSQueryExtension(mDisplay, &nothing, &nothing))
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
254 {
741
00f97e760cbc DPMS re-enable patch by Loring Holden
arpi_esp
parents: 723
diff changeset
255 if (!DPMSEnable(mDisplay)) { // restoring power saving settings
00f97e760cbc DPMS re-enable patch by Loring Holden
arpi_esp
parents: 723
diff changeset
256 printf("DPMS not available?\n");
00f97e760cbc DPMS re-enable patch by Loring Holden
arpi_esp
parents: 723
diff changeset
257 } else {
00f97e760cbc DPMS re-enable patch by Loring Holden
arpi_esp
parents: 723
diff changeset
258 // DPMS does not seem to be enabled unless we call DPMSInfo
00f97e760cbc DPMS re-enable patch by Loring Holden
arpi_esp
parents: 723
diff changeset
259 BOOL onoff;
00f97e760cbc DPMS re-enable patch by Loring Holden
arpi_esp
parents: 723
diff changeset
260 CARD16 state;
00f97e760cbc DPMS re-enable patch by Loring Holden
arpi_esp
parents: 723
diff changeset
261 DPMSInfo(mDisplay, &state, &onoff);
00f97e760cbc DPMS re-enable patch by Loring Holden
arpi_esp
parents: 723
diff changeset
262 if (onoff) {
00f97e760cbc DPMS re-enable patch by Loring Holden
arpi_esp
parents: 723
diff changeset
263 printf ("Successfully enabled DPMS\n");
00f97e760cbc DPMS re-enable patch by Loring Holden
arpi_esp
parents: 723
diff changeset
264 } else {
00f97e760cbc DPMS re-enable patch by Loring Holden
arpi_esp
parents: 723
diff changeset
265 printf ("Could not enable DPMS\n");
00f97e760cbc DPMS re-enable patch by Loring Holden
arpi_esp
parents: 723
diff changeset
266 }
00f97e760cbc DPMS re-enable patch by Loring Holden
arpi_esp
parents: 723
diff changeset
267 }
458
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
268 }
324
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
269 }
458
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
270
324
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
271 if (timeout_save)
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
272 {
458
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
273 int dummy, interval, prefer_blank, allow_exp;
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
274 XGetScreenSaver(mDisplay, &dummy, &interval, &prefer_blank, &allow_exp);
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
275 XSetScreenSaver(mDisplay, timeout_save, interval, prefer_blank, allow_exp);
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
276 XGetScreenSaver(mDisplay, &timeout_save, &interval, &prefer_blank, &allow_exp);
324
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
277 }
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
278
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
279 }
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
280
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
281 void saver_off(Display *mDisplay) {
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
282
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
283 int interval, prefer_blank, allow_exp, nothing;
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
284
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
285 if (DPMSQueryExtension(mDisplay, &nothing, &nothing))
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
286 {
458
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
287 BOOL onoff;
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
288 CARD16 state;
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
289 DPMSInfo(mDisplay, &state, &onoff);
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
290 if (onoff)
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
291 {
741
00f97e760cbc DPMS re-enable patch by Loring Holden
arpi_esp
parents: 723
diff changeset
292 Status stat;
458
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
293 printf ("Disabling DPMS\n");
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
294 dpms_disabled=1;
741
00f97e760cbc DPMS re-enable patch by Loring Holden
arpi_esp
parents: 723
diff changeset
295 stat = DPMSDisable(mDisplay); // monitor powersave off
00f97e760cbc DPMS re-enable patch by Loring Holden
arpi_esp
parents: 723
diff changeset
296 printf ("stat: %d\n", stat);
458
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
297 }
324
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
298 }
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
299 XGetScreenSaver(mDisplay, &timeout_save, &interval, &prefer_blank, &allow_exp);
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 32
diff changeset
300 if (timeout_save)
458
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
301 XSetScreenSaver(mDisplay, 0, interval, prefer_blank, allow_exp);
49b0474b2e26 I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents: 456
diff changeset
302 // turning off screensaver
326
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents: 324
diff changeset
303 }
448
198b46b739d8 qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents: 440
diff changeset
304
198b46b739d8 qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents: 440
diff changeset
305 #endif