Bug 1189622 part 3 - Return failure if fullscreen support is not available for the X11 desktop. r=karlt

This commit is contained in:
Xidorn Quan 2016-01-12 15:18:47 +11:00
parent 7f582514a2
commit b8f6b5e5bf
2 changed files with 18 additions and 0 deletions

View File

@ -127,6 +127,7 @@ STUB(gdk_x11_get_xatom_by_name)
STUB(gdk_x11_get_xatom_by_name_for_display)
STUB(gdk_x11_lookup_xdisplay)
STUB(gdk_x11_screen_get_xscreen)
STUB(gdk_x11_screen_supports_net_wm_hint)
STUB(gdk_x11_visual_get_xvisual)
STUB(gdk_x11_window_foreign_new_for_display)
STUB(gdk_x11_window_lookup_for_display)

View File

@ -4977,12 +4977,29 @@ nsWindow::PerformFullscreenTransition(FullscreenTransitionStage aStage,
transitionData, nullptr);
}
static bool
IsFullscreenSupported(GtkWidget* aShell)
{
#ifdef MOZ_X11
GdkScreen* screen = gtk_widget_get_screen(aShell);
GdkAtom atom = gdk_atom_intern("_NET_WM_STATE_FULLSCREEN", FALSE);
if (!gdk_x11_screen_supports_net_wm_hint(screen, atom)) {
return false;
}
#endif
return true;
}
NS_IMETHODIMP
nsWindow::MakeFullScreen(bool aFullScreen, nsIScreen* aTargetScreen)
{
LOG(("nsWindow::MakeFullScreen [%p] aFullScreen %d\n",
(void *)this, aFullScreen));
if (!IsFullscreenSupported(mShell)) {
return NS_ERROR_NOT_AVAILABLE;
}
if (aFullScreen) {
if (mSizeMode != nsSizeMode_Fullscreen)
mLastSizeMode = mSizeMode;