Is there a way to make a CEFPython app run full-screen (without titlebar or anything) in Windows? I did some poking around and saw some discussion about adding it to CEF, but didn't see anything conclusive about wether or not it is actually there. I did see the enable_fullscreen flag for BrowserSettings, but couldn't determine what, if any, effect it had.
-Benjamin
I was about to report that I had achieved my desired result using PyGTK, using the example in your package, adding
self.mainWindow.fullscreen()
and that worked pretty well, too.
Thanks for your contributions; I'll be keeping an eye on your CEF3 port as well.
Note that position and size is not restored, so you'll have to record that info and restore it.
You can use cefwindow.MoveWindow() or a win32 line like this:
win32gui.SetWindowPos(windowID, win32con.HWND_TOPMOST, 0, 0, 800, 600, 0)
# Bind F11 to go fullscreen.if keyCode == cefpython.VK_F11 and cefpython.IsKeyModifier(cefpython.KEY_NONE, modifiers): if platform.system() == "Windows": for_metro = False hwnd = browser.GetWindowID() # Logic copied from chromium > fullscreen_handler.cc > FullscreenHandler::SetFullscreenImpl: if not browser.GetUserData("is_fullscreen"): browser.SetUserData("SavedWindowInfo_maximized", ctypes.windll.user32.IsZoomed(hwnd)) if browser.GetUserData("SavedWindowInfo_maximized"): win32api.SendMessage(hwnd, win32con.WM_SYSCOMMAND, win32con.SC_RESTORE, 0) browser.SetUserData("SavedWindowInfo_gwl_style", win32api.GetWindowLong(hwnd, win32con.GWL_STYLE)) browser.SetUserData("SavedWindowInfo_gwl_exstyle", win32api.GetWindowLong(hwnd, win32con.GWL_EXSTYLE)) browser.SetUserData("SavedWindowInfo_window_rect", win32gui.GetWindowRect(hwnd))
if not browser.GetUserData("is_fullscreen"): gwl_style = browser.GetUserData("SavedWindowInfo_gwl_style") gwl_exstyle = browser.GetUserData("SavedWindowInfo_gwl_exstyle") remove_style = win32con.WS_CAPTION | win32con.WS_THICKFRAME remove_exstyle = win32con.WS_EX_DLGMODALFRAME | win32con.WS_EX_WINDOWEDGE remove_exstyle += win32con.WS_EX_CLIENTEDGE | win32con.WS_EX_STATICEDGE win32api.SetWindowLong(hwnd, win32con.GWL_STYLE, gwl_style & ~(remove_style)) win32api.SetWindowLong(hwnd, win32con.GWL_EXSTYLE, gwl_exstyle & ~(remove_exstyle)) if not for_metro: # MONITOR_DEFAULTTONULL, MONITOR_DEFAULTTOPRIMARY, MONITOR_DEFAULTTONEAREST monitor = win32api.MonitorFromWindow(hwnd, win32con.MONITOR_DEFAULTTONEAREST) monitorInfo = win32api.GetMonitorInfo(monitor) # keys: Device, Work, Monitor (left, top, right, bottom) = monitorInfo["Monitor"] win32gui.SetWindowPos(hwnd, None, left, top, right-left, bottom-top, win32con.SWP_NOZORDER | win32con.SWP_NOACTIVATE | win32con.SWP_FRAMECHANGED) else: gwl_style = browser.GetUserData("SavedWindowInfo_gwl_style") gwl_exstyle = browser.GetUserData("SavedWindowInfo_gwl_exstyle") win32api.SetWindowLong(hwnd, win32con.GWL_STYLE, gwl_style) win32api.SetWindowLong(hwnd, win32con.GWL_EXSTYLE, gwl_exstyle) if not for_metro: (left, top, right, bottom) = browser.GetUserData("SavedWindowInfo_window_rect") win32gui.SetWindowPos(hwnd, None, left, top, right-left, bottom-top, win32con.SWP_NOZORDER | win32con.SWP_NOACTIVATE | win32con.SWP_FRAMECHANGED) if browser.GetUserData("SavedWindowInfo_maximized"): win32api.SendMessage(hwnd, win32con.WM_SYSCOMMAND, win32con.SC_MAXIMIZE, 0)
browser.SetUserData("is_fullscreen", not bool(browser.GetUserData("is_fullscreen"))) return True