remove whitespace at eol
[goodguy/history.git] / cinelerra-5.1 / guicast / bcpopup.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #include "bcpopup.h"
23 #include "language.h"
24
25
26 BC_FullScreen::BC_FullScreen(BC_WindowBase *parent_window, int w, int h,
27                            int bg_color,
28                            int vm_scale,
29                            int hide,
30                            BC_Pixmap *bg_pixmap)
31  : BC_WindowBase()
32 {
33 #ifdef HAVE_LIBXXF86VM
34    if (vm_scale)
35            create_window(parent_window,
36                            _("Fullscreen"),
37                            parent_window->get_screen_x(0, -1),
38                            parent_window->get_screen_y(0, -1),
39                            w,
40                            h,
41                            w,
42                            h,
43                            0,
44                            parent_window->top_level->private_color,
45                            hide,
46                            bg_color,
47                            NULL,
48                            VIDMODE_SCALED_WINDOW,
49                            bg_pixmap,
50                            0);
51    else
52 #endif
53    create_window(parent_window,
54                            _("Fullscreen"),
55                            parent_window->get_screen_x(0, -1),
56                            parent_window->get_screen_y(0, -1),
57                            w,
58                            h,
59                            w,
60                            h,
61                            0,
62                            parent_window->top_level->private_color,
63                            hide,
64                            bg_color,
65                            NULL,
66                            POPUP_WINDOW,
67                            bg_pixmap,
68                            0);
69 }
70
71
72 BC_FullScreen::~BC_FullScreen()
73 {
74 }
75
76
77 BC_Popup::BC_Popup(BC_WindowBase *parent_window,
78                                 int x,
79                                 int y,
80                                 int w,
81                                 int h,
82                                 int bg_color,
83                                 int hide,
84                                 BC_Pixmap *bg_pixmap)
85  : BC_WindowBase()
86 {
87         create_window(parent_window,
88                                 _("Popup"),
89                                 x,
90                                 y,
91                                 w,
92                                 h,
93                                 w,
94                                 h,
95                                 0,
96                                 parent_window->top_level->private_color,
97                                 hide,
98                                 bg_color,
99                                 NULL,
100                                 POPUP_WINDOW,
101                                 bg_pixmap,
102                                 0);
103         grabbed = 0;
104 }
105
106
107 BC_Popup::~BC_Popup()
108 {
109 }
110
111
112 void BC_Popup::grab_keyboard()
113 {
114         if( !grabbed ) {
115                 lock_window("BC_Popup::grab_keyboard");
116                 if( !getenv("NO_KEYBOARD_GRAB") )
117                         XGrabKeyboard(top_level->display, win, False,
118                                 GrabModeAsync, GrabModeAsync, CurrentTime);
119                 else
120                         XSetInputFocus(top_level->display, win, RevertToParent, CurrentTime);
121                 unlock_window();  flush();  //  printf("grabbed\n");
122                 set_active_subwindow(this);
123                 grabbed = 1;
124         }
125 }
126
127 void BC_Popup::ungrab_keyboard()
128 {
129         if( grabbed ) {
130                 lock_window("BC_Popup::ungrab_keyboard");
131                 if( !getenv("NO_KEYBOARD_GRAB") )
132                         XUngrabKeyboard(top_level->display, CurrentTime);
133                 unlock_window();  flush(); //  printf("ungrabbed\n");
134                 set_active_subwindow(0);
135                 grabbed = 0;
136         }
137 }
138