Mercurial > mplayer.hg
comparison gui/interface.c @ 33960:1cd81338af07
Rework fullscreen handling.
This should fix all problems the GUI had with fullscreen handling.
In interface.c:
1. Remove disabled code.
2. Set background of inactive video window to black (which prevents
some flashing when starting the playback in fullscreen mode).
3. Set the state of the fullscreen button according to next playback
mode (normal or fullscreen).
4. Make the video window invisible if there is no video, but don't
make it visible that early if there is video.
5. Set the global fullscreen variable to get aspect scaling. (Hack)
6. In GUI_SETUP_VIDEO_WINDOW:
a. First set the video size,
b. then resize and reposition,
c. then make the window visible,
d. switch to/from fullscreen, if necessary.
(This minimizes disturbances and the display stays in fullscreen
mode and is smoothly black as often as possible.)
7. When playback ends, either act as in 6. or make video window
quickly invisible if requested.
In actions.c:
8. Allow calling uiFullScreen() even if not playing.
9. Remove unnecessary (and misplaced) repositioning (but not properly
resizing) code from uiFullScreen().
10. Don't call wsFullScreen() conditionally.
11. Only set global variable vo_fs, not the global fullscreen
variable.
author | ib |
---|---|
date | Thu, 01 Sep 2011 20:15:40 +0000 |
parents | ef089a8affc6 |
children | 30a443c59053 |
comparison
equal
deleted
inserted
replaced
33959:ef089a8affc6 | 33960:1cd81338af07 |
---|---|
55 #ifdef CONFIG_DVDREAD | 55 #ifdef CONFIG_DVDREAD |
56 #include "stream/stream_dvd.h" | 56 #include "stream/stream_dvd.h" |
57 #endif | 57 #endif |
58 | 58 |
59 guiInterface_t guiInfo = { | 59 guiInterface_t guiInfo = { |
60 .VideoWindow = True, | |
61 .StreamType = STREAMTYPE_DUMMY, | 60 .StreamType = STREAMTYPE_DUMMY, |
62 .Balance = 50.0f | 61 .Balance = 50.0f |
63 }; | 62 }; |
64 | 63 |
65 static int initialized; | 64 static int initialized; |
206 if (!guiApp.mainDecoration) | 205 if (!guiApp.mainDecoration) |
207 wsWindowDecoration(&guiApp.mainWindow, 0); | 206 wsWindowDecoration(&guiApp.mainWindow, 0); |
208 | 207 |
209 wsVisibleWindow(&guiApp.mainWindow, wsShowWindow); | 208 wsVisibleWindow(&guiApp.mainWindow, wsShowWindow); |
210 | 209 |
211 #if 0 | |
212 wsVisibleWindow(&guiApp.subWindow, wsShowWindow); | |
213 { | |
214 XEvent xev; | |
215 | |
216 do | |
217 XNextEvent(wsDisplay, &xev); | |
218 while (xev.type != MapNotify || xev.xmap.event != guiApp.subWindow.WindowID); | |
219 | |
220 guiApp.subWindow.Mapped = wsMapped; | |
221 } | |
222 | |
223 if (!fullscreen) | |
224 fullscreen = gtkLoadFullscreen; | |
225 | |
226 if (fullscreen) { | |
227 uiFullScreen(); | |
228 btnModify(evFullScreen, btnPressed); | |
229 } | |
230 #else | |
231 if (!fullscreen) | |
232 fullscreen = gtkLoadFullscreen; | |
233 | |
234 if (gtkShowVideoWindow) { | 210 if (gtkShowVideoWindow) { |
235 wsVisibleWindow(&guiApp.subWindow, wsShowWindow); | 211 wsVisibleWindow(&guiApp.subWindow, wsShowWindow); |
212 | |
236 { | 213 { |
237 XEvent xev; | 214 XEvent xev; |
238 | 215 |
239 do | 216 do |
240 XNextEvent(wsDisplay, &xev); | 217 XNextEvent(wsDisplay, &xev); |
241 while (xev.type != MapNotify || xev.xmap.event != guiApp.subWindow.WindowID); | 218 while (xev.type != MapNotify || xev.xmap.event != guiApp.subWindow.WindowID); |
242 | 219 |
243 guiApp.subWindow.Mapped = wsMapped; | 220 guiApp.subWindow.Mapped = wsMapped; |
244 } | 221 guiInfo.VideoWindow = True; |
245 | 222 } |
246 if (fullscreen) { | 223 |
224 if (gtkLoadFullscreen) | |
247 uiFullScreen(); | 225 uiFullScreen(); |
248 btnModify(evFullScreen, btnPressed); | 226 } else |
249 } | 227 wsSetBackgroundRGB(&guiApp.subWindow, 0, 0, 0); |
250 } else { | 228 |
251 if (fullscreen) { | 229 if (gtkLoadFullscreen) |
252 wsVisibleWindow(&guiApp.subWindow, wsShowWindow); | 230 btnModify(evFullScreen, btnPressed); |
253 { | |
254 XEvent xev; | |
255 | |
256 do | |
257 XNextEvent(wsDisplay, &xev); | |
258 while (xev.type != MapNotify || xev.xmap.event != guiApp.subWindow.WindowID); | |
259 | |
260 guiApp.subWindow.Mapped = wsMapped; | |
261 } | |
262 guiInfo.Playing = GUI_PAUSE; // because of !gtkShowVideoWindow... | |
263 uiFullScreen(); // ...guiInfo.Playing is required | |
264 wsVisibleWindow(&guiApp.subWindow, wsHideWindow); | |
265 btnModify(evFullScreen, btnPressed); | |
266 } | |
267 } | |
268 #endif | |
269 | 231 |
270 guiInfo.Playing = GUI_STOP; | 232 guiInfo.Playing = GUI_STOP; |
271 | 233 |
272 uiSubRender = 1; | 234 uiSubRender = 1; |
273 | 235 |
727 mplayer(MPLAYER_SET_EQUALIZER, 0, &eq); | 689 mplayer(MPLAYER_SET_EQUALIZER, 0, &eq); |
728 } | 690 } |
729 } | 691 } |
730 } | 692 } |
731 | 693 |
732 wsVisibleWindow(&guiApp.subWindow, (guiInfo.VideoWindow ? wsShowWindow : wsHideWindow)); | 694 // These must be done here (in the last call from MPlayer before |
695 // playback starts) and not in GUI_SETUP_VIDEO_WINDOW, because... | |
696 | |
697 // ...without video there will be no call to GUI_SETUP_VIDEO_WINDOW | |
698 if (!guiInfo.VideoWindow) { | |
699 wsVisibleWindow(&guiApp.subWindow, wsHideWindow); | |
700 btnModify(evFullScreen, gtkLoadFullscreen ? btnPressed : btnReleased); | |
701 } | |
702 | |
703 // ...option variable fullscreen determines whether MPlayer will handle | |
704 // the window given by WinID as fullscreen window (and will do aspect | |
705 // scaling then) or not - quite rubbish | |
706 fullscreen = gtkLoadFullscreen; | |
707 | |
733 break; | 708 break; |
734 | 709 |
735 case GUI_SET_MIXER: | 710 case GUI_SET_MIXER: |
736 if (mixer) { | 711 if (mixer) { |
737 float l, r; | 712 float l, r; |
758 uiEventHandling(evRedraw, 0); | 733 uiEventHandling(evRedraw, 0); |
759 break; | 734 break; |
760 | 735 |
761 case GUI_SETUP_VIDEO_WINDOW: | 736 case GUI_SETUP_VIDEO_WINDOW: |
762 | 737 |
763 if (!guiApp.subWindow.isFullScreen) { | |
764 wsResizeWindow(&guiApp.subWindow, vo_dwidth, vo_dheight); | |
765 wsMoveWindow(&guiApp.subWindow, True, guiApp.sub.x, guiApp.sub.y); | |
766 } | |
767 | |
768 guiInfo.VideoWidth = vo_dwidth; | 738 guiInfo.VideoWidth = vo_dwidth; |
769 guiInfo.VideoHeight = vo_dheight; | 739 guiInfo.VideoHeight = vo_dheight; |
770 | 740 |
741 if (!guiApp.subWindow.isFullScreen || !guiApp.subWindow.Mapped) { | |
742 if (!guiApp.subWindow.isFullScreen) | |
743 wsResizeWindow(&guiApp.subWindow, guiInfo.VideoWidth, guiInfo.VideoHeight); | |
744 | |
745 wsMoveWindow(&guiApp.subWindow, True, guiApp.sub.x, guiApp.sub.y); | |
746 | |
747 if (!guiApp.subWindow.Mapped) | |
748 wsVisibleWindow(&guiApp.subWindow, wsShowWindow); | |
749 } | |
750 | |
751 if (gtkLoadFullscreen ^ guiApp.subWindow.isFullScreen) | |
752 uiEventHandling(evFullScreen, 0); | |
753 | |
771 if (guiWinID >= 0) | 754 if (guiWinID >= 0) |
772 wsMoveWindow(&guiApp.mainWindow, False, 0, vo_dheight); | 755 wsMoveWindow(&guiApp.mainWindow, False, 0, guiInfo.VideoHeight); |
773 | 756 |
774 break; | 757 break; |
775 | 758 |
776 case GUI_HANDLE_X_EVENT: | 759 case GUI_HANDLE_X_EVENT: |
777 wsEvents(wsDisplay, data); | 760 wsEvents(wsDisplay, data); |
805 guiInfo.Track = 1; | 788 guiInfo.Track = 1; |
806 guiInfo.Chapter = 1; | 789 guiInfo.Chapter = 1; |
807 guiInfo.Angle = 1; | 790 guiInfo.Angle = 1; |
808 #endif | 791 #endif |
809 | 792 |
810 if (!guiApp.subWindow.isFullScreen && gtkShowVideoWindow) { | 793 if (gtkShowVideoWindow) { |
811 wsResizeWindow(&guiApp.subWindow, guiApp.sub.width, guiApp.sub.height); | 794 guiInfo.VideoWindow = True; |
812 wsMoveWindow(&guiApp.subWindow, True, guiApp.sub.x, guiApp.sub.y); | 795 guiInfo.VideoWidth = guiApp.sub.width; |
813 } else | 796 guiInfo.VideoHeight = guiApp.sub.height; |
797 | |
798 if (!guiApp.subWindow.isFullScreen) { | |
799 wsResizeWindow(&guiApp.subWindow, guiInfo.VideoWidth, guiInfo.VideoHeight); | |
800 wsMoveWindow(&guiApp.subWindow, True, guiApp.sub.x, guiApp.sub.y); | |
801 } | |
802 | |
803 if (!guiApp.subWindow.Mapped) | |
804 wsVisibleWindow(&guiApp.subWindow, wsShowWindow); | |
805 | |
806 if (gtkLoadFullscreen ^ guiApp.subWindow.isFullScreen) | |
807 uiEventHandling(evFullScreen, 0); | |
808 } else { | |
814 wsVisibleWindow(&guiApp.subWindow, wsHideWindow); | 809 wsVisibleWindow(&guiApp.subWindow, wsHideWindow); |
810 guiInfo.VideoWindow = False; | |
811 btnModify(evFullScreen, gtkLoadFullscreen ? btnPressed : btnReleased); | |
812 } | |
815 | 813 |
816 gui(GUI_SET_STATE, (void *)GUI_STOP); | 814 gui(GUI_SET_STATE, (void *)GUI_STOP); |
817 | 815 |
818 wsHandleEvents(); | 816 wsHandleEvents(); |
819 uiSubRender = 1; | 817 uiSubRender = 1; |