Skip to content

Commit

Permalink
X11: Handle keyboard layout changing during app's run on Ubuntu 12.04…
Browse files Browse the repository at this point in the history
… (etc).

Fixes Bugzilla #3050 (in addition to Jason Wyatt's patch, prior to this).
  • Loading branch information
icculus committed Aug 15, 2015
1 parent 0d8c3a0 commit 8145760
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/video/x11/SDL_x11events.c
Expand Up @@ -1134,8 +1134,15 @@ X11_DispatchEvent(_THIS)
} else {
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESTORED, 0, 0);
}
}

}
} else if (xevent.xproperty.atom == videodata->XKLAVIER_STATE) {
/* Hack for Ubuntu 12.04 (etc) that doesn't send MappingNotify
events when the keyboard layout changes (for example,
changing from English to French on the menubar's keyboard
icon). Since it changes the XKLAVIER_STATE property, we
notice and reinit our keymap here. This might not be the
right approach, but it seems to work. */
X11_UpdateKeymap(_this);
}
}
break;
Expand Down
1 change: 1 addition & 0 deletions src/video/x11/SDL_x11video.c
Expand Up @@ -408,6 +408,7 @@ X11_VideoInit(_THIS)
GET_ATOM(XdndDrop);
GET_ATOM(XdndFinished);
GET_ATOM(XdndSelection);
GET_ATOM(XKLAVIER_STATE);

/* Detect the window manager */
X11_CheckWindowManager(_this);
Expand Down
1 change: 1 addition & 0 deletions src/video/x11/SDL_x11video.h
Expand Up @@ -111,6 +111,7 @@ typedef struct SDL_VideoData
Atom XdndDrop;
Atom XdndFinished;
Atom XdndSelection;
Atom XKLAVIER_STATE;

SDL_Scancode key_layout[256];
SDL_bool selection_waiting;
Expand Down

0 comments on commit 8145760

Please sign in to comment.