New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Frameless windows (macOS implementation) #177
Conversation
webview/__init__.py
Outdated
@@ -189,6 +189,7 @@ def create_window(title, url=None, js_api=None, width=800, height=600, | |||
:param strings: a dictionary with localized strings | |||
:param confirm_quit: Display a quit confirmation dialog. Default is False | |||
:param background_color: Background color as a hex string that is displayed before the content of webview is loaded. Default is white. | |||
:param frameless: Whether the window should havea frame. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
havea typo
webview/cocoa.py
Outdated
screenFrame = AppKit.NSScreen.mainScreen().frame() | ||
if screenFrame is None: | ||
sys.stderr.write('failed to obtain screen\n') | ||
raise RuntimeError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to raise a RuntimeError('Failed to obtain screen')
. Same with the rest of RuntimeErrors
webview/cocoa.py
Outdated
@@ -224,7 +271,7 @@ def performKeyEquivalent_(self, theEvent): | |||
|
|||
return handled | |||
|
|||
def __init__(self, title, url, width, height, resizable, fullscreen, min_size, background_color, debug, js_api, webview_ready): | |||
def __init__(self, title, url, width, height, resizable, fullscreen, min_size, background_color, debug, js_api, webview_ready, frameless): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please place frameless
before webview_ready
webview/cocoa.py
Outdated
@@ -244,15 +291,25 @@ def __init__(self, title, url, width, height, resizable, fullscreen, min_size, b | |||
if resizable: | |||
window_mask = window_mask | AppKit.NSResizableWindowMask | |||
|
|||
if frameless is True: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if frameless
webview/cocoa.py
Outdated
|
||
self.webkit = BrowserView.WebKitHost.alloc().initWithFrame_(rect) | ||
if frameless is True: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if frameless
@r0x0r I've pushed the changes. I see the multi window branch is now merged (woo!) and will handle those conflicts too when I get a chance! |
webview/cocoa.py
Outdated
@@ -244,15 +290,25 @@ def __init__(self, title, url, width, height, resizable, fullscreen, min_size, b | |||
if resizable: | |||
window_mask = window_mask | AppKit.NSResizableWindowMask | |||
|
|||
if frameless: | |||
window_mask = window_mask | AppKit.NSFullSizeContentViewWindowMask | AppKit.NSTexturedBackgroundWindowMask |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NSFullSizeContentViewWindowMask
is now deprecated. Doesn't work in High Sierra. If
we are to use this, we would need an OS API version check. Also a way to do it in 10.13+
Edit: NSWindowStyleMaskFullSizeContentView
works in High Sierra.
webview/cocoa.py
Outdated
drag_bar = DragBar.alloc().initWithFrame_(rect) | ||
drag_bar.setAutoresizingMask_(AppKit.NSViewWidthSizable) | ||
BrowserView.instance.window.contentView().addSubview_(drag_bar) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason this code (line 204 to 215) is put here? Do we need to update the drag
bar every time the page loads? If not, the best place for it would be in the __init__()
function itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I managed to move it to init in 841ca88 (new to pyobjc!).
…ndows # Conflicts: # webview/cocoa.py
I have also made some small changes and bug fixes: * Default title bar height is 22; changed to it from 24. * We cannot not set content view of window in __init__, should be done in the load-finish delegate. Originally this was to support background color, but now a couple of other things depend on it as well.
Fix compatibility issues and refactor
[Qt] Correct frameless parameter position
@shivaprsdv sounds good to me; definitely better than merging into |
@shivaprsdv ok to merge to a new branch |
@Fizzadar I considered it appropriate to do a Squash before Merge. Thanks for |
* [All] Add skeleton for `frameless` parameter * [Cocoa] Add `frameless` kwarg to remove the window frame. - Implement a DragBar class to enable dragging the webview - Make the drag bar stick to the top and autoresize to the width of the view.
* [All] Add skeleton for `frameless` parameter * [Cocoa] Add `frameless` kwarg to remove the window frame. - Implement a DragBar class to enable dragging the webview - Make the drag bar stick to the top and autoresize to the width of the view.
* Merge PR #177: [Cocoa] Implement frameless windows * [All] Add skeleton for `frameless` parameter * [Cocoa] Add `frameless` kwarg to remove the window frame. - Implement a DragBar class to enable dragging the webview - Make the drag bar stick to the top and autoresize to the width of the view. * [WinForms] Implement frameless window + easy drag * Merge PR #177: [Cocoa] Implement frameless windows * [All] Add skeleton for `frameless` parameter * [Cocoa] Add `frameless` kwarg to remove the window frame. - Implement a DragBar class to enable dragging the webview - Make the drag bar stick to the top and autoresize to the width of the view. * [WinForms] Implement frameless window + easy drag * [GTK] partial implementation of frameless window * [QT] Partial implementation of frameless window * [QT] implement easy drag * [Cocoa] Hide standard buttons and make the entire window draggable * [GTK] implement easy move * Add frameless tests * Remove unused parameter * [Cocoa] Implement free drag * Revert WebBrowserInterops * Code cleanup * Update interop DLLs * Fix interop dll * Update docs; Fix tests * Add example * Update examples
* Merge PR #177: [Cocoa] Implement frameless windows * [All] Add skeleton for `frameless` parameter * [Cocoa] Add `frameless` kwarg to remove the window frame. - Implement a DragBar class to enable dragging the webview - Make the drag bar stick to the top and autoresize to the width of the view. * [WinForms] Implement frameless window + easy drag * Merge PR #177: [Cocoa] Implement frameless windows * [All] Add skeleton for `frameless` parameter * [Cocoa] Add `frameless` kwarg to remove the window frame. - Implement a DragBar class to enable dragging the webview - Make the drag bar stick to the top and autoresize to the width of the view. * [WinForms] Implement frameless window + easy drag * [GTK] partial implementation of frameless window * [QT] Partial implementation of frameless window * [QT] implement easy drag * [Cocoa] Hide standard buttons and make the entire window draggable * [GTK] implement easy move * Add frameless tests * Remove unused parameter * [Cocoa] Implement free drag * Revert WebBrowserInterops * Code cleanup * Update interop DLLs * Fix interop dll * Update docs; Fix tests * Add example * Update examples
* Update change_url.md * Update api.md * Update installation.md * Add Google Analytics * Fix installation * 2.4 info * [Docs] add information about window.pywebview availability * Update debuggig info about QTWebEngine * [Docs] Add information about app architecture * Update cef.md * [CEF] Fix JS logic not persisting after navigating to another page * #169 Frameless window (#313) * Merge PR #177: [Cocoa] Implement frameless windows * [All] Add skeleton for `frameless` parameter * [Cocoa] Add `frameless` kwarg to remove the window frame. - Implement a DragBar class to enable dragging the webview - Make the drag bar stick to the top and autoresize to the width of the view. * [WinForms] Implement frameless window + easy drag * Merge PR #177: [Cocoa] Implement frameless windows * [All] Add skeleton for `frameless` parameter * [Cocoa] Add `frameless` kwarg to remove the window frame. - Implement a DragBar class to enable dragging the webview - Make the drag bar stick to the top and autoresize to the width of the view. * [WinForms] Implement frameless window + easy drag * [GTK] partial implementation of frameless window * [QT] Partial implementation of frameless window * [QT] implement easy drag * [Cocoa] Hide standard buttons and make the entire window draggable * [GTK] implement easy move * Add frameless tests * Remove unused parameter * [Cocoa] Implement free drag * Revert WebBrowserInterops * Code cleanup * Update interop DLLs * Fix interop dll * Update docs; Fix tests * Add example * Update examples * [CEF]: Implement support for pyinstaller one-file mode * [CEF] Fix typo * [All] Change api_call timeout to 15 seconds * Update setup.py * [QT] Simplify QT installation * New API Cocoa implementation Revamped tests and examples * Fix web engine force setting * Rename destroy_window to destroy * Update documentation * Add documentation for 2.4 * Refactor project structure * [GTK] New API support * Rename confirm_quit to confirm_close Split lifecycle events to shown and loaded * [GTK] Implement new API Fix tests * [QT] New API implementation * Remove multiprocessing * [Windows/CEF] New API implementation * Implement CSRF token [All] Implement get_element * Update Flask app example * Rename get_element to get_elements. Bug fixes. * [GTK] Implement propert JS-Python bridge for WebKit2 >2.2 * Update documentation * [Windows/CEF] New API implementation * Add token test * [Winforms] Fix js api initialization * [Cocoa] Fix events * Debug: print webkit version * [GTK] Check for old webkit * [GTK] Fix event issues * Catch notimlementederror in tests * Update travis conf with qt from pip * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * [Windows] Preliminary implementation of EdgeHTML based on PR from @HeavenVolkoff * [docs] Add information about EdgeHTML * EdgeHTML WIP * Remove windows.web import * EdgeHTML improvements. Fix MSHTML evaluate_js * [Docs] Add information about renderer limitations * [EdgeHTML] Fix bugs and tests * Remove window from windows list after it is destroyed * Fix window object deletion after window is closed via GUI * [Docs] Add information about renderer codes * Refactor and fix JS API Remove multiprocessing example [MSHTML] Add console.log debug support * [Travis] Change conf * [WinForms] Fix fullscreen * Fix dll installation * [Windows] Fix DLL bundling * Update changelog * [CEF]: Fix JS API * Update changelog * Built-in HTTP server implementation * Add http server test * Add http server testcd * Add http server testcd * [EdgeHTML] allow localhost urls * Add video example * Bug fixing * [Cocoa] Remove media prefs * Update .travis.yml * Update .travis.yml * Update .travis.yml * [Travis] Disable QT 5.12 builds * Update html_load.md
Implements frameless windows (Cocoa only currently!).
Partly implements: #169