Skip to content

Commit

Permalink
Merge branch 'main' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
dacap committed Jan 6, 2025
2 parents 2647cc0 + 41b11d6 commit d3e6a2c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
sudo apt-get install -y \
libc++-dev libc++abi-dev \
libpixman-1-dev libfreetype6-dev libharfbuzz-dev zlib1g-dev \
libx11-dev libxcursor-dev libxi-dev libgl1-mesa-dev
libx11-dev libxcursor-dev libxi-dev libgl1-mesa-dev libfontconfig1-dev
fi
if [[ "${{ matrix.backend }}" == "skia" ]] ; then
if [[ "${{ matrix.build_type }}" == "RelWithDebInfo" ]] ; then
Expand Down
14 changes: 14 additions & 0 deletions os/osx/app_delegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <Cocoa/Cocoa.h>

#include "os/osx/app_delegate.h"
#include "os/osx/window.h"

#include "base/fs.h"
#include "os/event.h"
Expand Down Expand Up @@ -93,13 +94,26 @@ - (void)applicationWillTerminate:(NSNotification*)notification

- (void)applicationWillResignActive:(NSNotification*)notification
{
for (id window : [NSApp windows]) {
if ([window isKindOfClass:[WindowOSXObjc class]] && [window isFloating]) {
[window setLevel:NSNormalWindowLevel];
[window orderWindow:NSWindowAbove relativeTo:0];
}
}

NSEvent* event = [NSApp currentEvent];
if (event != nil)
[ViewOSX updateKeyFlags:event];
}

- (void)applicationDidBecomeActive:(NSNotification*)notification
{
for (id window : [NSApp windows]) {
if ([window isKindOfClass:[WindowOSXObjc class]] && [window isFloating]) {
[window setLevel:NSFloatingWindowLevel];
}
}

NSEvent* event = [NSApp currentEvent];
if (event != nil)
[ViewOSX updateKeyFlags:event];
Expand Down
2 changes: 2 additions & 0 deletions os/osx/window.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class WindowOSX;
WindowOSXDelegate* __strong m_delegate;
ViewOSX* __strong m_view;
int m_scale;
bool m_floating;
}
- (WindowOSXObjc*)initWithImpl:(os::WindowOSX*)impl spec:(const os::WindowSpec*)spec;
- (os::WindowOSX*)impl;
Expand All @@ -51,6 +52,7 @@ class WindowOSX;
- (void)setMousePosition:(const gfx::Point&)position;
- (BOOL)setNativeCursor:(os::NativeCursor)cursor;
- (BOOL)canBecomeKeyWindow;
- (BOOL)isFloating;
@end

using WindowOSXObjc_id = WindowOSXObjc*;
Expand Down
10 changes: 7 additions & 3 deletions os/osx/window.mm
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,9 @@ - (WindowOSXObjc*)initWithImpl:(os::WindowOSX*)impl spec:(const os::WindowSpec*)

[self makeKeyAndOrderFront:self];

if (spec->floating()) {
m_floating = spec->floating();
if (spec->floating())
self.level = NSFloatingWindowLevel;
self.hidesOnDeactivate = true;
}

if (spec->modal())
self.level = NSModalPanelWindowLevel;
Expand Down Expand Up @@ -255,6 +254,11 @@ - (BOOL)canBecomeKeyWindow
return NO;
}

- (BOOL)isFloating
{
return m_floating;
}

- (void)noResponderFor:(SEL)eventSelector
{
if (eventSelector == @selector(keyDown:)) {
Expand Down

0 comments on commit d3e6a2c

Please sign in to comment.