Mercurial > mplayer.hg
annotate Gui/mplayer/mplayer.c @ 7116:e751a2b0991d
written by Florian Schilhabel <florian.schilhabel@gmx.net>
author | alex |
---|---|
date | Wed, 28 Aug 2002 17:14:02 +0000 |
parents | 0fa27966ac47 |
children | e5dda05f9aab |
rev | line source |
---|---|
1693 | 1 |
2 #include <stdlib.h> | |
3 #include <stdio.h> | |
4 #include <string.h> | |
4428 | 5 #include <inttypes.h> |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6912
diff
changeset
|
6 #include <sys/types.h> |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6912
diff
changeset
|
7 #include <sys/stat.h> |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6912
diff
changeset
|
8 #include <unistd.h> |
1693 | 9 |
10 #include "./mplayer.h" | |
11 #include "../events.h" | |
12 #include "../app.h" | |
6794 | 13 #include "../cfg.h" |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
14 #include "../interface.h" |
1693 | 15 #include "../skin/skin.h" |
16 #include "../skin/font.h" | |
17 #include "../wm/ws.h" | |
18 #include "../wm/wskeys.h" | |
19 #include "../wm/widget.h" | |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6912
diff
changeset
|
20 #include "../wm/wsxdnd.h" |
1693 | 21 #include "../bitmap/bitmap.h" |
22 | |
23 #include "../../config.h" | |
1884 | 24 #include "../../help_mp.h" |
1776 | 25 #include "../../libvo/x11_common.h" |
2970 | 26 #include "../../libmpdemux/stream.h" |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
27 #include "../../mp_msg.h" |
1693 | 28 |
6651 | 29 #include <gdk/gdkprivate.h> |
30 #include <gdk/gdkkeysyms.h> | |
31 #include <gdk/gdk.h> | |
32 #include <gtk/gtk.h> | |
33 | |
1697 | 34 #define mplRedrawTimerConst 5 |
1693 | 35 |
36 int mplRedrawTimer = mplRedrawTimerConst; | |
37 int mplTimer = 0; | |
38 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
39 void mplEventHandling( int msg,float param ); |
1693 | 40 |
41 #include "widgets.h" | |
42 #include "play.h" | |
43 #include "menu.h" | |
44 #include "mw.h" | |
45 #include "sw.h" | |
1801 | 46 #include "widgets.h" |
1693 | 47 |
6218 | 48 void mplInit( void * disp ) |
1693 | 49 { |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1860
diff
changeset
|
50 int i; |
2854 | 51 |
6898 | 52 #if 0 |
2854 | 53 // init fields of this struct to default values |
6219 | 54 guiIntfStruct.Balance=50.0f; |
55 guiIntfStruct.StreamType=-1; | |
2854 | 56 |
6218 | 57 gtkInit(); |
1693 | 58 |
6891
e1c5f3128b3a
gui.conf parsing moved to after gtkInit() - should fix i18n problems
arpi
parents:
6840
diff
changeset
|
59 // read gui.conf, gui.pl |
e1c5f3128b3a
gui.conf parsing moved to after gtkInit() - should fix i18n problems
arpi
parents:
6840
diff
changeset
|
60 cfg_read(); |
e1c5f3128b3a
gui.conf parsing moved to after gtkInit() - should fix i18n problems
arpi
parents:
6840
diff
changeset
|
61 |
1697 | 62 // opens X display, checks for extensions (XShape, DGA etc) |
6218 | 63 wsXInit( disp ); |
6912 | 64 #endif |
1693 | 65 |
66 if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) | |
67 { | |
1884 | 68 fprintf( stderr,MSGTR_NEMDB ); |
1693 | 69 exit( 0 ); |
70 } | |
71 | |
72 wsCreateWindow( &appMPlayer.subWindow, | |
73 appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height, | |
3080 | 74 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsHideWindow,"ViDEO" ); |
1693 | 75 |
3080 | 76 wsDestroyImage( &appMPlayer.subWindow ); |
77 wsCreateImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height ); | |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6912
diff
changeset
|
78 wsXDNDMakeAwareness(&appMPlayer.subWindow); |
3080 | 79 |
80 vo_setwindow( appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC ); | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
81 |
6280 | 82 // i=wsHideFrame|wsMaxSize|wsHideWindow; |
83 // if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow; | |
84 i=wsShowFrame|wsMaxSize|wsHideWindow; | |
1693 | 85 wsCreateWindow( &appMPlayer.mainWindow, |
86 appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height, | |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1860
diff
changeset
|
87 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); //wsMinSize| |
1693 | 88 |
89 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); | |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6912
diff
changeset
|
90 wsXDNDMakeAwareness(&appMPlayer.mainWindow); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
91 |
1693 | 92 mplMenuInit(); |
93 | |
94 #ifdef DEBUG | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
95 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] Depth on screen: %d\n",wsDepthOnScreen ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
96 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
97 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID ); |
1693 | 98 #endif |
99 | |
100 appMPlayer.mainWindow.ReDraw=mplMainDraw; | |
101 appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle; | |
102 appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle; | |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6912
diff
changeset
|
103 appMPlayer.mainWindow.DandDHandler=mplDandDHandler; |
1693 | 104 |
105 appMPlayer.subWindow.ReDraw=mplSubDraw; | |
106 appMPlayer.subWindow.MouseHandler=mplSubMouseHandle; | |
107 appMPlayer.subWindow.KeyHandler=mplMainKeyHandle; | |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6912
diff
changeset
|
108 appMPlayer.subWindow.DandDHandler=mplDandDHandler; |
1693 | 109 |
2029 | 110 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); |
3080 | 111 wsClearWindow( appMPlayer.subWindow ); |
2025
0653e90b3118
some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents:
1884
diff
changeset
|
112 if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize ); |
0653e90b3118
some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents:
1884
diff
changeset
|
113 |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
114 btnModify( evSetVolume,guiIntfStruct.Volume ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
115 btnModify( evSetBalance,guiIntfStruct.Balance ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
116 btnModify( evSetMoviePosition,guiIntfStruct.Position ); |
6651 | 117 |
118 wsSetIcon( wsDisplay,appMPlayer.mainWindow.WindowID,guiIcon,guiIconMask ); | |
119 wsSetIcon( wsDisplay,appMPlayer.subWindow.WindowID,guiIcon,guiIconMask ); | |
5046 | 120 |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
121 guiIntfStruct.Playing=0; |
1693 | 122 |
6280 | 123 if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 ); |
124 | |
3080 | 125 wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow ); |
6898 | 126 #if 1 |
3080 | 127 wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); |
6794 | 128 |
129 { | |
130 XEvent xev; | |
131 do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID ); | |
132 appMPlayer.subWindow.Mapped=wsMapped; | |
133 } | |
134 | |
135 if ( fullscreen ) | |
136 { | |
137 mplFullScreen(); | |
138 btnModify( evFullScreen,btnPressed ); | |
139 } | |
6840 | 140 #endif |
6794 | 141 mplSubRender=1; |
1709 | 142 } |
143 |