Skip to content

Commit

Permalink
8338000: [macos] Remove GlassFullscreenWindow
Browse files Browse the repository at this point in the history
Reviewed-by: kcr, mstrauss
  • Loading branch information
Martin Fox committed Nov 28, 2024
1 parent a45e33c commit bdfc338
Show file tree
Hide file tree
Showing 11 changed files with 2 additions and 223 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#import <jni.h>

#import "GlassHostView.h"
#import "GlassFullscreenWindow.h"
#import "GlassViewDelegate.h"

// main GlassView protocol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,6 @@ - (BOOL)performKeyEquivalent:(NSEvent *)theEvent
{
KEYLOG("performKeyEquivalent");

// Crash if the FS window is released while performing a key equivalent
// Local copy of the id keeps the retain/release calls balanced.
id fsWindow = [self->_delegate->fullscreenWindow retain];

// RT-37093, RT-37399 Command-EQUALS and Command-DOT needs special casing on Mac
// as it is passed through as two calls to performKeyEquivalent, which in turn
// create extra KeyEvents.
Expand Down Expand Up @@ -500,13 +496,11 @@ - (BOOL)performKeyEquivalent:(NSEvent *)theEvent
(*env)->DeleteLocalRef(env, jKeyChars);

GLASS_CHECK_EXCEPTION(env);
[fsWindow release];
return YES;
}
}

BOOL result = [self handleKeyDown: theEvent];
[fsWindow release];
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#import <jni.h>

#import "GlassHostView.h"
#import "GlassFullscreenWindow.h"
#import "GlassDragSource.h"
#import "GlassDraggingSource.h"
#import "GlassAccessible.h"
Expand Down Expand Up @@ -69,8 +68,6 @@ typedef enum GestureMaskType {

@public
jobject jView;
// not nil when we create a new FS window ourselves
GlassFullscreenWindow *fullscreenWindow;
}

- (id)initWithView:(NSView*)view withJview:(jobject)jview;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,6 @@ - (void)dealloc
[self->parentWindow release];
self->parentWindow = nil;

[self->fullscreenWindow release];
self->fullscreenWindow = nil;

[self->nativeFullScreenModeWindow release];
self->nativeFullScreenModeWindow = nil;

Expand Down Expand Up @@ -1282,40 +1279,6 @@ - (void)exitFullscreenWithAnimate:(BOOL)animate
[GlassApplication enterFullScreenExitingLoop];
return;
}

[self->fullscreenWindow toggleFullScreen:self->fullscreenWindow];

NSRect frame = [self->parentHost bounds];
frame.origin = [self->fullscreenWindow point];
[self->fullscreenWindow setFrame:frame display:YES animate:animate];

[self->fullscreenWindow disableFlushWindow];
{
[self->nsView retain];
{
[self->nsView removeFromSuperviewWithoutNeedingDisplay];
[self->parentHost addSubview:self->nsView];
}
[self->nsView release];

[self->parentWindow setInitialFirstResponder:self->nsView];
[self->parentWindow makeFirstResponder:self->nsView];

if ([[self->parentWindow delegate] isKindOfClass:[GlassWindow class]])
{
GlassWindow *window = (GlassWindow*)[self->parentWindow delegate];
[window setFullscreenWindow: nil];
}
}
[self->fullscreenWindow enableFlushWindow];
[self->parentWindow enableFlushWindow];

[self->fullscreenWindow orderOut:nil];
[self->fullscreenWindow close];
self->fullscreenWindow = nil;

// It was retained upon entering the FS mode
[self->nsView release];
}
@catch (NSException *e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
- (void)_sendJavaWindowNotifyScaleChanged:(CGFloat)newScale;

- (id)_initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle screen:(NSScreen *)screen jwindow:(jobject)jwindow;
- (NSWindow*)_getCurrentWindow;
- (void)_ungrabFocus;
+ (void)_resetGrab;
- (void)_checkUngrab;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,9 @@ - (id)_initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle
return self;
}

- (NSWindow*)_getCurrentWindow
{
return self->fullscreenWindow ? self->fullscreenWindow : self->nsWindow;
}

- (void)_ungrabFocus
{
NSWindow *window = [self _getCurrentWindow];
NSWindow *window = self->nsWindow;

if (s_grabWindow != window) {
return;
Expand Down Expand Up @@ -207,7 +202,7 @@ - (void)_checkUngrab

- (void)_grabFocus
{
NSWindow *window = [self _getCurrentWindow];
NSWindow *window = self->nsWindow;

if (s_grabWindow == window) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ - (void)dealloc

- (void)windowDidBecomeKey:(NSNotification *)notification
{
if (self->fullscreenWindow)
{
return;
}

GET_MAIN_JENV;
if (!self->isEnabled)
{
Expand All @@ -86,11 +81,6 @@ - (void)windowDidBecomeKey:(NSNotification *)notification

- (void)windowDidResignKey:(NSNotification *)notification
{
if (self->fullscreenWindow)
{
return;
}

[self _ungrabFocus];

GET_MAIN_JENV_NOWARN;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
NSScreen *currentScreen;
GlassMenubar *menubar;
NSRect preZoomedRect;
NSWindow *fullscreenWindow;

BOOL isFocusable;
BOOL isEnabled;
Expand All @@ -68,8 +67,6 @@
BOOL isWindowResizable;
}

- (void)setFullscreenWindow:(NSWindow *)fsWindow;

// NSWindow overrides delegate methods
- (void)close;
- (void)sendEvent:(NSEvent *)event;
Expand Down
31 changes: 0 additions & 31 deletions modules/javafx.graphics/src/main/native-glass/mac/GlassWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -291,35 +291,6 @@ - (id)accessibilityAttributeValue:(NSString *)attribute

@implementation GlassWindow

- (void)setFullscreenWindow:(NSWindow*)fsWindow
{
if (self->fullscreenWindow == fsWindow) {
return;
}

[self _ungrabFocus];

NSWindow *from, *to;
from = self->fullscreenWindow ? self->fullscreenWindow : self->nsWindow;
to = fsWindow ? fsWindow : self->nsWindow;

NSArray * children = [from childWindows];
for (NSUInteger i=0; i<[children count]; i++)
{
NSWindow *child = (NSWindow*)[children objectAtIndex:i];
if ([[child delegate] isKindOfClass: [GlassWindow class]]) {
[from removeChildWindow: child];
[to addChildWindow:child ordered:NSWindowAbove];
}
}

self->fullscreenWindow = fsWindow;

GET_MAIN_JENV;
(*env)->CallVoidMethod(env, self->jWindow, jWindowNotifyDelegatePtr, ptr_to_jlong(fsWindow));
GLASS_CHECK_EXCEPTION(env);
}

- (void)close
{
[self _ungrabFocus];
Expand Down Expand Up @@ -503,8 +474,6 @@ static jlong _createWindowCommonDo(JNIEnv *env, jobject jWindow, jlong jOwnerPtr
[window->nsWindow setOpaque:YES];
}

window->fullscreenWindow = nil;

window->isSizeAssigned = NO;
window->isLocationAssigned = NO;

Expand Down

0 comments on commit bdfc338

Please sign in to comment.