mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-24 12:21:34 +00:00
* Source/x11/XGServerEvent.m (_handleTakeFocusAtom:forContext:): use
`cWin` instead of `this_window` * ChangeLog: updated.
This commit is contained in:
parent
124a18f026
commit
4e5f2ddbb1
2 changed files with 15 additions and 19 deletions
|
@ -2,10 +2,8 @@
|
||||||
|
|
||||||
* Source/x11/XGServerEvent.m (_handleTakeFocusAtom:forContext:): use
|
* Source/x11/XGServerEvent.m (_handleTakeFocusAtom:forContext:): use
|
||||||
lowerCamelCase for objects and underscores for primitive types;
|
lowerCamelCase for objects and underscores for primitive types;
|
||||||
Added and used `this_window` variable - represents window that has
|
do not ignore TakeFocus request if no key window was set
|
||||||
received TakeFocus event - instead of `cWin` (last used window by
|
and main application menu receives request.
|
||||||
backend); do not ignore TakeFocus request if now key window was set
|
|
||||||
and if main application menu received request.
|
|
||||||
|
|
||||||
2020-01-14 Sergii Stoian <stoyan255@gmail.com>
|
2020-01-14 Sergii Stoian <stoyan255@gmail.com>
|
||||||
|
|
||||||
|
|
|
@ -1914,18 +1914,16 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor
|
||||||
int key_num;
|
int key_num;
|
||||||
NSWindow *keyWindow;
|
NSWindow *keyWindow;
|
||||||
NSEvent *e = nil;
|
NSEvent *e = nil;
|
||||||
gswindow_device_t *this_window;
|
|
||||||
gswindow_device_t *key_window;
|
gswindow_device_t *key_window;
|
||||||
|
|
||||||
keyWindow = [NSApp keyWindow];
|
keyWindow = [NSApp keyWindow];
|
||||||
key_num = [keyWindow windowNumber];
|
key_num = [keyWindow windowNumber];
|
||||||
key_window = [XGServer _windowWithTag:key_num];
|
key_window = [XGServer _windowWithTag:key_num];
|
||||||
this_window = [XGServer _windowForXWindow:xEvent.xfocus.window];
|
|
||||||
|
|
||||||
NSDebugLLog(@"Focus",
|
NSDebugLLog(@"Focus",
|
||||||
@"TakeFocus received by: %li (%lu) (focused = %lu, key = %d, cWin = %lu)",
|
@"TakeFocus received by: %li (%lu) (focused = %lu, key = %d)",
|
||||||
this_window->number, xEvent.xfocus.window,
|
cWin->number, xEvent.xfocus.window,
|
||||||
generic.currentFocusWindow, key_num, cWin->number);
|
generic.currentFocusWindow, key_num);
|
||||||
|
|
||||||
/* Invalidate the previous request. It's possible the app lost focus
|
/* Invalidate the previous request. It's possible the app lost focus
|
||||||
before this request was fufilled and we are being focused again,
|
before this request was fufilled and we are being focused again,
|
||||||
|
@ -1941,11 +1939,11 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor
|
||||||
*/
|
*/
|
||||||
if (key_num == 0)
|
if (key_num == 0)
|
||||||
{
|
{
|
||||||
this_window->ignore_take_focus = NO;
|
cWin->ignore_take_focus = NO;
|
||||||
}
|
}
|
||||||
else if (this_window->number == [[[NSApp mainMenu] window] windowNumber])
|
else if (cWin->number == [[[NSApp mainMenu] window] windowNumber])
|
||||||
{
|
{
|
||||||
this_window->ignore_take_focus = NO;
|
cWin->ignore_take_focus = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We'd like to send this event directly to the front-end to handle,
|
/* We'd like to send this event directly to the front-end to handle,
|
||||||
|
@ -1960,18 +1958,18 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor
|
||||||
window to take focus after each one gets hidden. */
|
window to take focus after each one gets hidden. */
|
||||||
NSDebugLLog(@"Focus", @"WM take focus while hiding");
|
NSDebugLLog(@"Focus", @"WM take focus while hiding");
|
||||||
}
|
}
|
||||||
else if (this_window->ignore_take_focus == YES)
|
else if (cWin->ignore_take_focus == YES)
|
||||||
{
|
{
|
||||||
NSDebugLLog(@"Focus", @"Ignoring window focus request");
|
NSDebugLLog(@"Focus", @"Ignoring window focus request");
|
||||||
this_window->ignore_take_focus = NO;
|
cWin->ignore_take_focus = NO;
|
||||||
}
|
}
|
||||||
else if (this_window->number == key_num)
|
else if (cWin->number == key_num)
|
||||||
{
|
{
|
||||||
NSDebugLLog(@"Focus", @"Reasserting key window");
|
NSDebugLLog(@"Focus", @"Reasserting key window");
|
||||||
[GSServerForWindow(keyWindow) setinputfocus: key_num];
|
[GSServerForWindow(keyWindow) setinputfocus: key_num];
|
||||||
}
|
}
|
||||||
else if (key_num &&
|
else if (key_num &&
|
||||||
this_window->number == [[[NSApp mainMenu] window] windowNumber])
|
cWin->number == [[[NSApp mainMenu] window] windowNumber])
|
||||||
{
|
{
|
||||||
/* This might occur when the window manager just wants someone
|
/* This might occur when the window manager just wants someone
|
||||||
to become key, so it tells the main menu (typically the first
|
to become key, so it tells the main menu (typically the first
|
||||||
|
@ -1980,8 +1978,8 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor
|
||||||
NSDebugLLog(@"Focus", @"Key window is already %d", key_num);
|
NSDebugLLog(@"Focus", @"Key window is already %d", key_num);
|
||||||
if (key_window->map_state == IsUnmapped) {
|
if (key_window->map_state == IsUnmapped) {
|
||||||
/* `key_window` was unmapped by window manager.
|
/* `key_window` was unmapped by window manager.
|
||||||
`this_window` and `key_window` are on the different workspace. */
|
this window and `key_window` are on the different workspace. */
|
||||||
[GSServerForWindow(keyWindow) setinputfocus: this_window->number];
|
[GSServerForWindow(keyWindow) setinputfocus: cWin->number];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
[GSServerForWindow(keyWindow) setinputfocus: key_num];
|
[GSServerForWindow(keyWindow) setinputfocus: key_num];
|
||||||
|
@ -2002,7 +2000,7 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor
|
||||||
location: eventLocation
|
location: eventLocation
|
||||||
modifierFlags: 0
|
modifierFlags: 0
|
||||||
timestamp: 0
|
timestamp: 0
|
||||||
windowNumber: this_window->number
|
windowNumber: cWin->number
|
||||||
context: gcontext
|
context: gcontext
|
||||||
subtype: GSAppKitWindowFocusIn
|
subtype: GSAppKitWindowFocusIn
|
||||||
data1: 0
|
data1: 0
|
||||||
|
|
Loading…
Reference in a new issue