annotate gui/mplayer/sw.c @ 32734:cc58a1e919d9

Allow character in the font description file to be in UTF-8. A character defined in the font description file can be either an ASCII character, any character in the range of 0x80 to 0xFF or - to avoid character set problems, and that is recommended - a character in UTF-8 encoding now. Non-ASCII characters will be stored in the nonASCIIidx array. The indices 0..127 of this array correspond to the indices 128..255 of the Fnt array. (This also settles the "Translate messages shown in the GUI window(s) from UTF-8" issue.)
author ib
date Thu, 27 Jan 2011 18:04:19 +0000
parents 319ae9dc51a2
children 9566100d88a1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26458
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
1 /*
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
2 * sub window
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
3 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
4 * This file is part of MPlayer.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
5 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
6 * MPlayer is free software; you can redistribute it and/or modify
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
7 * it under the terms of the GNU General Public License as published by
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
9 * (at your option) any later version.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
10 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
11 * MPlayer is distributed in the hope that it will be useful,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
14 * GNU General Public License for more details.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
15 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
16 * You should have received a copy of the GNU General Public License along
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
19 */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
20
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
21 #include <inttypes.h>
23305
22d3d12c6dfb Include string.h for memcpy, fastmemcpy.h alone is not enough.
reimar
parents: 23154
diff changeset
22 #include <string.h>
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
23
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
24 #include "config.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
25 #include "libvo/x11_common.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
26 #include "help_mp.h"
30516
f4e017b6921a Fix exit_player() usage throughout the codebase.
diego
parents: 29263
diff changeset
27 #include "mp_core.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
28
23154
e564b9cd7290 Fix several implicit declarations of functions warnings.
diego
parents: 23077
diff changeset
29 #include "gmplayer.h"
26365
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 23374
diff changeset
30 #include "gui/app.h"
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 23374
diff changeset
31 #include "gui/interface.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
32 #include "widgets.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
33
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
34 int mplSubRender = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
35 int SubVisible = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
36
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
37 void mplSubDraw( void )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
38 {
30516
f4e017b6921a Fix exit_player() usage throughout the codebase.
diego
parents: 29263
diff changeset
39 if ( appMPlayer.subWindow.State == wsWindowClosed ) exit_player( EXIT_QUIT );
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26458
diff changeset
40
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
41 if ( appMPlayer.subWindow.State == wsWindowFocusIn ) SubVisible++;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
42 if ( appMPlayer.subWindow.State == wsWindowFocusOut && metacity_hack != 3 ) SubVisible--;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
43
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
44 if ( !appMPlayer.subWindow.Mapped ||
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
45 appMPlayer.subWindow.Visible == wsWindowNotVisible ) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
46
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
47 if ( guiIntfStruct.Playing ) mplSubRender=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
48
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
49 if ( mplSubRender && appMPlayer.subWindow.State == wsWindowExpose )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
50 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
51 if ( appMPlayer.sub.Bitmap.Image ) wsPutImage( &appMPlayer.subWindow );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
52 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
53 appMPlayer.subWindow.State=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
54 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
55
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
56 void mplSubMouseHandle( int Button,int X,int Y,int RX,int RY )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
57 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
58 static int mplSubMoved = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
59 static int msButton = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
60
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
61 mplPBShow( X,Y );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
62
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
63 switch( Button )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
64 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
65 case wsRRMouseButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
66 gtkShow( evShowPopUpMenu,NULL );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
67 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
68 case wsPMMouseButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
69 gtkShow( evHidePopUpMenu,NULL );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
70 mplShowMenu( RX,RY );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
71 msButton=wsPMMouseButton;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
72 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
73 case wsRMMouseButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
74 mplHideMenu( RX,RY,1 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
75 msButton=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
76 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
77 // ---
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
78 case wsPLMouseButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
79 gtkShow( evHidePopUpMenu,NULL );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
80 sx=X; sy=Y;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
81 msButton=wsPLMouseButton;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
82 mplSubMoved=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
83 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
84 case wsMoveMouse:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
85 switch ( msButton )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
86 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
87 case wsPLMouseButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
88 mplSubMoved=1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
89 if ( !appMPlayer.subWindow.isFullScreen ) wsMoveWindow( &appMPlayer.subWindow,False,RX - sx,RY - sy );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
90 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
91 case wsPMMouseButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
92 mplMenuMouseHandle( X,Y,RX,RY );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
93 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
94 default: mplPBShow( X,Y ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
95 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
96 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
97 case wsRLMouseButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
98 if ( ( !mplSubMoved )&&( appMPlayer.subWindow.isFullScreen ) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
99 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
100 if( SubVisible++%2 ) wsMoveTopWindow( wsDisplay,appMPlayer.mainWindow.WindowID );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
101 else wsMoveTopWindow( wsDisplay,appMPlayer.subWindow.WindowID );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
102 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
103 msButton=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
104 mplSubMoved=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
105 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
106 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
107 }