Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upMake Window::set_fullscreen pass a non-None value when entering fullscreen #22853
Comments
|
Hi! If you have any questions regarding this issue, feel free to make a comment here, or ask it in the If you intend to work on this issue, then add |
|
@highfive assign me. I am new on this project. Would like to start with this issue |
|
Hey @kamal-umudlu! Thanks for your interest in working on this issue. It's now assigned to you! |
|
Hi, |
|
I tried to pass get_primary_monitor() in Some value under get_allow_fullscreen() but it looks like there is no window.get_primary_monitor() function in windows.rs file. I am new in this project maybe I am wrong. Could you please give a little clarification about issue? |
|
Sorry, I should have been more specific about the code I was looking at:
|
|
Hi Josh, Is there any way to make only video to become full screen or am I running wrong html file? |
|
Our existing fullscreen support (inside of a window, rather than actually making the window fullscreen) is supposed to do what you describe. Have you tried https://www.joshmatthews.net/webgl2.html? |
|
As for leaving fullscreen, I would expect fixing the code in document.rs to avoid that problem. |
|
Yeah I understood fullscreen support and also tried https://www.joshmatthews.net/webgl2.html. I was expecting the same behaviour from fullscreen-region-content-001.html but maybe I am missing something that doesn't make video element to become full size. My expectation was after passing window.set_fullscreen(Some(window.get_primary_monitor())), it will get video element and make it full screen which doesn't. |
|
That may be related to #22358. We have observed fullscreen support not working for videos in particular. |
|
I wouldn't expect the changes for this issue to affect #22358. |
|
Oh sure. Is there any other fix I need to do other than passing monitor_id and changing SetFullscreenState to true in exit_fullscreen? |
|
If those make the window enter fullscreen mode and leave it, then no :) |
|
The only issue I have right now is when I press "ESC" keyboard button, it close the whole servo app (doesn't make difference if it is in fullscreen mode or not). Is it also issue that I need to fix? If yes, is there any way to map "ESC" button to exit_fullscreen() function? |
|
Ooh, that's a very good point. So, the decision to quit Servo happens in |
|
Sure I can try :) But the only thing I just need to make sure is it is feasible to fix it until Friday noon.
|
2&3. |
|
Thanks :) I will do my best and will let you know if I have any question. |
|
Is there any public getter function to check whether self.window is in fullscreen mode or not? |
|
Actually it looks like you can check |
|
oh I thought it is a private value, if it is public value then it is fine :) |
|
Update I have tried to use self.window.fulscreen, but it seems like it is private value. So, I can't actually use self.window.fullscreen :( I am actually so close to the fix, but don't know If I should add getter function for fullscreen value. |
|
Like I said, self.fullscreen instead of self.window. |
|
So I was saying in browser.rs file, is there any way to access fullscreen state? I have tried self.fullscreen too but it says there is no field. Is there way to get state of fullscreen in browser.rs? |
|
Here is my code in browser.rs |
|
Oh, I'm sorry. I kept mixing up which file we were talking about. Yes, go ahead and add a public getter to Window that returns self.fullscreen. |
|
I added getter function and now I can get self.fulscreen value. Right now I don't have any compile error and I have tested my code on fullscreen-region-content-002.html. But it is not actually changing fullscreen mode when I pressed ESC button. So my guess is, I am missing something in script_thread.rs file. This is the code I added to script_thread.rs file. Am I missing something here?
|
|
That seems reasonable. Have you tried using a debugger or adding println! statements to make sure the new code is being executed? |
|
I am trying now. Just one quick question. After adding println statements, do I have to build project again? |
|
Yes. |
|
So yeah I added println statements and seems like the new code is being executed. But in document.exit_fullscreen() function, after executing let promise = Promise::new(global.r()); it is crashing. Is there any file or function that actually calls document.exit_fullscreen()? |
|
When I search the code (using grep or ack, for example) I see let _ac = JSAutoCompartment::new(document.global().get_cx(), document.reflector().get_jsobject().get()); |
|
Can I just add that code on my handler like this?
|
|
I tested it. I think it worked :) |
…when entering fullscreen is fixed and SetFullscreenState in exit_fullscreen changed to False
|
Hi Josh. I have one more last question :) Should I create two different Pull Requests for one fixing issue #22853 and the second for adding |
|
One PR for both commits is fine. |
…when entering fullscreen is fixed and SetFullscreenState in exit_fullscreen changed to False Added patch for bug:22853 Added implementation to exit from fullscreen mode by pressing ESC button Added patch that supports to exit from fullscreen mode by pressing ESC Deleted patch files Added all requested changes on project Removed the loop over self.pending_changes in switch_fullscreen_mode function Bug servo#22853 - Make Window::set_fullscreen pass a non-None value when entering fullscreen is fixed and SetFullscreenState in exit_fullscreen changed to False
…when entering fullscreen is fixed and SetFullscreenState in exit_fullscreen changed to False Added patch for bug:22853 Added implementation to exit from fullscreen mode by pressing ESC button Added patch that supports to exit from fullscreen mode by pressing ESC Deleted patch files Added all requested changes on project Removed the loop over self.pending_changes in switch_fullscreen_mode function Bug servo#22853 - Make Window::set_fullscreen pass a non-None value when entering fullscreen is fixed and SetFullscreenState in exit_fullscreen changed to False Added missing bracket in constellation.rs file to fix build issue Bug: servo#22853 --> Make Window::set_fullscreen pass a non-None value when entering fullscreen is fixed and SetFullscreenState in exit_fullscreen changed to False
…een, r=jdm Pass not none value in setfullscreen <!-- Please describe your changes on the following line: --> # Diagnose Entering fullscreen mode is passing `None` value to `Window` when `set_fullscreen` function is called which prevents Servo actually entering fullscreen mode. In addition, the function `exit_fullscreen` in `document.rs` is passing True value to `SetFullscreenState` which doesn't allow to exit from fullscreen mode. # Solution 1. Instead of passing `None` value when `FullScreenState` is true, `window.get_primary_monitor()` is called in order to pass a monitor id. This fix make Servo actually enter fullscreen mode. 2. Changed `SetFullscreenState` to false when `exit_fullscreen` function is called. 3. In addition, added new implementation to support exiting from fullscreen mode by pressing `Escape` button. # Testing Plan After my change in [windows.rs and document.rs](kamal-umudlu@af6b598), the Servo app can enter/exit fullscreen mode. In addition, the [`ESC button support`](kamal-umudlu@14ebd5b) allows to exit from fullscreenmode. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #22853 <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23128) <!-- Reviewable:end -->
…een, r=jdm Pass not none value in setfullscreen <!-- Please describe your changes on the following line: --> # Diagnose Entering fullscreen mode is passing `None` value to `Window` when `set_fullscreen` function is called which prevents Servo actually entering fullscreen mode. In addition, the function `exit_fullscreen` in `document.rs` is passing True value to `SetFullscreenState` which doesn't allow to exit from fullscreen mode. # Solution 1. Instead of passing `None` value when `FullScreenState` is true, `window.get_primary_monitor()` is called in order to pass a monitor id. This fix make Servo actually enter fullscreen mode. 2. Changed `SetFullscreenState` to false when `exit_fullscreen` function is called. 3. In addition, added new implementation to support exiting from fullscreen mode by pressing `Escape` button. # Testing Plan After my change in [windows.rs and document.rs](kamal-umudlu@af6b598), the Servo app can enter/exit fullscreen mode. In addition, the [`ESC button support`](kamal-umudlu@14ebd5b) allows to exit from fullscreenmode. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #22853 <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23128) <!-- Reviewable:end -->
I expect we can call
window.get_primary_monitor()to get a monitor id, then pass that in aSomevalue whenstateis true. This will hopefully make Servo actually enter full screen mode.It looks like we will also need to change the use of
SetFullscreenStateinexit_fullscreenin document.rs to pass the valuefalse, or we will never be able to exit fullscreen mode.https://www.joshmatthews.net/webgl2.html should be able to verify if these changes are behaving as expected.