annotate audacious/fullscreen.c @ 341:46271e2c9622 trunk

[svn] Initial tagging_mp4.c code. Still need to add a class for aac tagging information (ID3)
author nenolod
date Mon, 26 Dec 2005 00:38:59 -0800
parents cb178e5ad177
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1 /* XMMS - Cross-platform multimedia player
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
2 * Copyright (C) 1998-2000 Zinx Verituse
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
3 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
5 * it under the terms of the GNU General Public Licensse as published by
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
7 * (at your option) any later version.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
8 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
9 * This program is distributed in the hope that it will be useful,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
12 * GNU General Public License for more details.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
13 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
15 * along with this program; if not, write to the Free Software
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
17 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
18 #ifdef HAVE_CONFIG_H
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
19 # include "config.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
20 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
21
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
22 #include "fullscreen.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
23
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
24 #include "libaudacious/util.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
25
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
26 #include <X11/Xlib.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
27 #include <X11/Xatom.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
28 #include <X11/Xmd.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
29
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
30 #ifndef XF86VIDMODE
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
31
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
32 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
33 xmms_fullscreen_available(Display * dpy)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
34 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
35 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
36 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
37
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
38 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
39 xmms_fullscreen_init(GtkWidget * win)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
40 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
41 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
42 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
43
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
44 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
45 xmms_fullscreen_enter(GtkWidget * win, gint * w, gint * h)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
46 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
47 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
48 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
49
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
50 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
51 xmms_fullscreen_leave(GtkWidget * win)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
52 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
53 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
54 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
55
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
56 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
57 xmms_fullscreen_in(GtkWidget * win)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
58 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
59 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
60 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
61
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
62 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
63 xmms_fullscreen_mark(GtkWidget * win)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
64 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
65 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
66 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
67
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
68 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
69 xmms_fullscreen_unmark(GtkWidget * win)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
70 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
71 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
72 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
73
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
74 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
75 xmms_fullscreen_cleanup(GtkWidget * win)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
76 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
77 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
78 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
79
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
80 GSList *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
81 xmms_fullscreen_modelist(GtkWidget * win)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
82 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
83 return NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
84 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
85
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
86 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
87 xmms_fullscreen_modelist_free(GSList * modes)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
88 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
89 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
90 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
91
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
92 #else /* XF86VIDMODE */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
93
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
94 #include <X11/extensions/xf86vmode.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
95 #include <X11/extensions/xf86vmstr.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
96
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
97 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
98 xmms_fullscreen_available(Display * dpy)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
99 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
100 int event_base, error_base, num_modes;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
101 XF86VidModeModeInfo **dummy;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
102
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
103 if (!XF86VidModeQueryExtension(dpy, &event_base, &error_base))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
104 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
105
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
106 XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &num_modes, &dummy);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
107 XFree(dummy);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
108
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
109 return (num_modes > 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
110 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
111
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
112 typedef struct {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
113 Display *display;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
114 XF86VidModeModeInfo **modes, *origmode;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
115 gboolean is_full, can_full;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
116 gint num_modes;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
117 } fullscreen_display_t;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
118
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
119 static fullscreen_display_t **displays = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
120
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
121 typedef struct {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
122 GtkWidget *window;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
123 gint is_full;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
124 gint ox, oy, owidth, oheight;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
125 fullscreen_display_t *display;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
126 } fullscreen_window_t;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
127 static fullscreen_window_t **windows = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
128
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
129 G_LOCK_DEFINE_STATIC(full_mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
130
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
131 #define FULL_LOCK() G_LOCK(full_mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
132 #define FULL_UNLOCK() G_UNLOCK(full_mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
133
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
134 static fullscreen_display_t *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
135 getdisplay(Display * dpy)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
136 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
137 gint i;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
138
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
139 if (displays) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
140 for (i = 0; displays[i]; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
141 if (displays[i]->display == dpy)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
142 return displays[i];
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
143 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
144 displays = g_realloc(displays, sizeof(*displays) * (i + 2));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
145 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
146 else {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
147 displays = g_malloc(sizeof(*displays) * 2);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
148 i = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
149 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
150 displays[i + 1] = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
151 displays[i] = g_malloc(sizeof(**displays));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
152 displays[i]->display = dpy;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
153 displays[i]->modes = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
154 displays[i]->origmode = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
155 displays[i]->num_modes = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
156 displays[i]->is_full = FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
157 displays[i]->can_full = FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
158 return displays[i];
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
159 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
160
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
161 static fullscreen_window_t *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
162 getwindow(GtkWidget * win)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
163 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
164 gint i;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
165
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
166 if (windows) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
167 for (i = 0; windows[i]; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
168 if (windows[i]->window == win)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
169 return windows[i];
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
170 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
171 windows = g_realloc(windows, sizeof(*windows) * (i + 2));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
172 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
173 else {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
174 windows = g_malloc(sizeof(*windows) * 2);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
175 i = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
176 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
177 windows[i + 1] = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
178 windows[i] = g_malloc(sizeof(**windows));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
179 windows[i]->window = win;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
180 windows[i]->ox = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
181 windows[i]->oy = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
182 windows[i]->owidth = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
183 windows[i]->oheight = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
184 windows[i]->display = getdisplay(GDK_WINDOW_XDISPLAY(win->window));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
185 windows[i]->is_full = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
186 return windows[i];
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
187 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
188
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
189 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
190 xmms_fullscreen_init(GtkWidget * win)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
191 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
192 int event_base, error_base, dummy;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
193 fullscreen_window_t *fwin;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
194 gint i;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
195 XF86VidModeModeLine origmode;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
196
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
197 FULL_LOCK();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
198 fwin = getwindow(win);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
199
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
200 if (!XF86VidModeQueryExtension
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
201 (fwin->display->display, &event_base, &error_base)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
202 FULL_UNLOCK();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
203 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
204 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
205
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
206 if (!fwin->display->modes) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
207 XF86VidModeGetAllModeLines(fwin->display->display,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
208 DefaultScreen(fwin->display->display),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
209 &fwin->display->num_modes,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
210 &fwin->display->modes);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
211
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
212 if (!fwin->display->origmode) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
213 XF86VidModeGetModeLine(fwin->display->display,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
214 DefaultScreen(fwin->display->display),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
215 &dummy, &origmode);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
216 for (i = 0; i < fwin->display->num_modes; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
217 if (fwin->display->modes[i]->hdisplay ==
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
218 origmode.hdisplay
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
219 && fwin->display->modes[i]->vdisplay ==
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
220 origmode.vdisplay) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
221 fwin->display->origmode = fwin->display->modes[i];
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
222 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
223 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
224 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
225
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
226 if (!fwin->display->origmode) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
227 fprintf(stderr,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
228 "ERROR: Could not determine original mode.\n");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
229 FULL_UNLOCK();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
230 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
231 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
232
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
233 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
234
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
235 fwin->display->can_full = (fwin->display->num_modes > 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
236 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
237 FULL_UNLOCK();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
238 return fwin->display->can_full;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
239 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
240
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
241 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
242 xmms_fullscreen_enter(GtkWidget * win, gint * w, gint * h)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
243 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
244 gint i, close, how_close = -1, t, dummy;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
245 gboolean retval = FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
246 fullscreen_window_t *fwin;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
247
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
248 FULL_LOCK();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
249 fwin = getwindow(win);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
250
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
251 if (!fwin->display->is_full && !fwin->is_full && fwin->display->can_full) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
252 for (close = 0; close < fwin->display->num_modes; close++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
253 if ((fwin->display->modes[close]->hdisplay >= *w) &&
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
254 (fwin->display->modes[close]->vdisplay >= *h)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
255 how_close = fwin->display->modes[close]->hdisplay - *w;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
256 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
257 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
258 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
259
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
260 for (i = close + 1; i < fwin->display->num_modes; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
261 if (fwin->display->modes[i]->vdisplay < *h)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
262 continue;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
263 t = fwin->display->modes[i]->hdisplay - *w;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
264 if (t >= 0 && t < how_close) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
265 close = i;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
266 how_close = t;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
267 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
268 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
269
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
270 if (close < fwin->display->num_modes) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
271 *w = fwin->display->modes[close]->hdisplay;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
272 *h = fwin->display->modes[close]->vdisplay;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
273
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
274 /* Save the old position/size */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
275 gdk_window_get_root_origin(fwin->window->window, &fwin->ox,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
276 &fwin->oy);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
277 gdk_window_get_size(fwin->window->window, &fwin->owidth,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
278 &fwin->oheight);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
279
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
280 /* Move it. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
281 gdk_window_move_resize(fwin->window->window, 0, 0,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
282 fwin->display->modes[close]->hdisplay,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
283 fwin->display->modes[close]->vdisplay);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
284
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
285 /* Tell the WM not to mess with this window (no more decor) */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
286 gdk_window_hide(fwin->window->window);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
287 gdk_window_set_override_redirect(fwin->window->window, TRUE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
288 gdk_window_show(fwin->window->window);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
289
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
290 /*
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
291 * XXX: HACK
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
292 * Something is ungrabbing the pointer shortly
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
293 * after the above unmap/override_redirect=TRUE/map
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
294 * is done. I don't know what at this time, only
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
295 * that it's not XMMS, and that it's very very evil.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
296 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
297 gdk_flush();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
298 xmms_usleep(50000);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
299
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
300 /* Steal the keyboard/mouse */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
301 /* XXX: FIXME, use timeouts.. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
302 for (t = 0; t < 10; t++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
303 dummy = gdk_pointer_grab(fwin->window->window,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
304 TRUE, 0,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
305 fwin->window->window,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
306 NULL, GDK_CURRENT_TIME);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
307
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
308 if (dummy == GrabSuccess)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
309 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
310
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
311 gtk_main_iteration_do(FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
312 xmms_usleep(10000);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
313 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
314 gdk_keyboard_grab(fwin->window->window, TRUE, GDK_CURRENT_TIME);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
315
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
316 /* Do the video mode switch.. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
317 XF86VidModeSwitchToMode(fwin->display->display,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
318 DefaultScreen(fwin->display->display),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
319 fwin->display->modes[close]);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
320
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
321 XF86VidModeSetViewPort(fwin->display->display,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
322 DefaultScreen(fwin->display->display),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
323 0, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
324
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
325 retval = TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
326
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
327 fwin->is_full = TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
328 fwin->display->is_full = TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
329 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
330 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
331
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
332 FULL_UNLOCK();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
333
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
334 return retval;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
335 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
336
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
337 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
338 xmms_fullscreen_leave(GtkWidget * win)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
339 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
340 fullscreen_window_t *fwin;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
341
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
342 FULL_LOCK();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
343 fwin = getwindow(win);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
344
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
345 if (fwin->is_full && fwin->display->is_full) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
346 /* Release our grabs */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
347 gdk_pointer_ungrab(GDK_CURRENT_TIME);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
348 gdk_keyboard_ungrab(GDK_CURRENT_TIME);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
349
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
350 /* Let the WM manage this window again */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
351 gdk_window_hide(fwin->window->window);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
352 gdk_window_set_override_redirect(fwin->window->window, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
353 gdk_window_show(fwin->window->window);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
354
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
355 /* Restore size/position */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
356 gdk_window_move_resize(fwin->window->window, fwin->ox, fwin->oy,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
357 fwin->owidth, fwin->oheight);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
358
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
359 XF86VidModeSwitchToMode(fwin->display->display,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
360 DefaultScreen(fwin->display->display),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
361 fwin->display->origmode);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
362 fwin->display->is_full = FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
363 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
364 fwin->is_full = FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
365 FULL_UNLOCK();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
366 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
367
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
368 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
369 xmms_fullscreen_in(GtkWidget * win)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
370 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
371 fullscreen_window_t *fwin;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
372
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
373 FULL_LOCK();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
374 fwin = getwindow(win);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
375 FULL_UNLOCK();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
376
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
377 if (fwin->display->is_full)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
378 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
379 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
380 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
381 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
382
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
383 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
384 xmms_fullscreen_mark(GtkWidget * win)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
385 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
386 fullscreen_window_t *fwin;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
387
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
388 FULL_LOCK();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
389 fwin = getwindow(win);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
390
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
391 if (fwin->display->is_full) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
392 FULL_UNLOCK();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
393 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
394 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
395 else {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
396 fwin->is_full = TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
397 fwin->display->is_full = TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
398 FULL_UNLOCK();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
399 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
400 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
401 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
402
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
403 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
404 xmms_fullscreen_unmark(GtkWidget * win)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
405 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
406 fullscreen_window_t *fwin;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
407
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
408 FULL_LOCK();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
409 fwin = getwindow(win);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
410
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
411 if (fwin->is_full) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
412 fwin->is_full = FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
413 fwin->display->is_full = FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
414 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
415 FULL_UNLOCK();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
416 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
417
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
418 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
419 xmms_fullscreen_cleanup(GtkWidget * win)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
420 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
421 gint i, j;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
422 fullscreen_display_t *display;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
423
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
424 FULL_LOCK();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
425 if (!windows)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
426 goto unlock_return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
427
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
428 for (i = 0; windows[i]; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
429 if (windows[i]->window == win) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
430 display = windows[i]->display;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
431 for (j = i + 1; windows[j]; j++);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
432 windows[i] = windows[j - 1];
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
433 windows = g_realloc(windows, sizeof(*windows) * (j + 1));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
434 windows[j] = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
435
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
436 for (i = 0; windows[i]; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
437 if (windows[i]->display == display)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
438 goto unlock_return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
439 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
440 /* bugger all, kill the display */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
441 for (i = 0; displays[i]; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
442 if (displays[i] == display) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
443 XFree(displays[i]->modes);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
444 for (j = i + 1; displays[j]; j++);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
445 displays[i] = displays[j - 1];
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
446 displays =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
447 g_realloc(displays, sizeof(*displays) * (j + 1));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
448 displays[j] = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
449 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
450 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
451 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
452 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
453 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
454 unlock_return:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
455 FULL_UNLOCK();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
456 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
457
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
458 GSList *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
459 xmms_fullscreen_modelist(GtkWidget * win)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
460 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
461 fullscreen_window_t *fwin;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
462 xmms_fullscreen_mode_t *ent;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
463 GSList *retlist = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
464 int i;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
465
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
466 FULL_LOCK();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
467 fwin = getwindow(win);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
468
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
469 for (i = 0; i < fwin->display->num_modes; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
470 ent = g_malloc(sizeof(*ent));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
471 ent->width = fwin->display->modes[i]->hdisplay;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
472 ent->height = fwin->display->modes[i]->vdisplay;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
473 retlist = g_slist_append(retlist, ent);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
474 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
475 FULL_UNLOCK();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
476
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
477 return retlist;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
478 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
479
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
480 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
481 xmms_fullscreen_modelist_free(GSList * modes)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
482 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
483 g_slist_foreach(modes, (GFunc) g_free_func, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
484 g_slist_free(modes);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
485 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
486
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
487 #endif /* XF86VIDMODE */