Skip to content
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

Merged
merged 15 commits into from Mar 31, 2018

Conversation

Fizzadar
Copy link
Contributor

@Fizzadar Fizzadar commented Feb 14, 2018

Implements frameless windows (Cocoa only currently!).

Partly implements: #169

@@ -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.
Copy link
Owner

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
Copy link
Owner

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):
Copy link
Owner

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:
Copy link
Owner

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:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if frameless

@Fizzadar
Copy link
Contributor Author

@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
Copy link
Collaborator

@shivaprsd shivaprsd Feb 23, 2018

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)

Copy link
Collaborator

@shivaprsd shivaprsd Feb 23, 2018

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.

Copy link
Contributor Author

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!).

Fizzadar and others added 5 commits March 7, 2018 21:19
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
@shivaprsd shivaprsd changed the title Frameless windows Frameless windows (macOS implementation) Mar 27, 2018
[Qt] Correct frameless parameter position
@shivaprsd shivaprsd mentioned this pull request Mar 28, 2018
3 tasks
@shivaprsd
Copy link
Collaborator

shivaprsd commented Mar 28, 2018

@Fizzadar @r0x0r As this PR implements the feature only in macOS, I don't
think it should go straight into master, especially since we're preparing for a
new release. I'm creating a new feature branch frameless and changing the
base of this PR to it. If this is okay, this can be merged at once.

@shivaprsd shivaprsd changed the base branch from master to frameless March 28, 2018 11:02
@Fizzadar
Copy link
Contributor Author

@shivaprsdv sounds good to me; definitely better than merging into master when only macOS is supported :)

@r0x0r
Copy link
Owner

r0x0r commented Mar 30, 2018

@shivaprsdv ok to merge to a new branch

@shivaprsd shivaprsd merged commit 9801550 into r0x0r:frameless Mar 31, 2018
@shivaprsd
Copy link
Collaborator

@Fizzadar I considered it appropriate to do a Squash before Merge. Thanks for
the contribution! 🤗

@Fizzadar Fizzadar deleted the frameless-windows branch September 5, 2018 20:46
r0x0r pushed a commit that referenced this pull request Sep 23, 2018
* [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.
r0x0r pushed a commit that referenced this pull request Oct 8, 2018
* [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.
r0x0r pushed a commit that referenced this pull request Feb 16, 2019
* 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
r0x0r pushed a commit that referenced this pull request Apr 29, 2019
* 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
r0x0r pushed a commit that referenced this pull request Jul 7, 2019
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants