forked from LeenkxTeam/LNXRNT
Update
This commit is contained in:
@ -49,6 +49,8 @@ void kinc_window_show(int window_index) {}
|
||||
|
||||
void kinc_window_hide(int window_index) {}
|
||||
|
||||
void kinc_window_set_foreground(int window_index) {}
|
||||
|
||||
void kinc_window_set_title(int window_index, const char *title) {}
|
||||
|
||||
int kinc_window_create(kinc_window_options_t *win, kinc_framebuffer_options_t *frame) {
|
||||
|
||||
@ -63,6 +63,8 @@ void kinc_window_show(int window_index) {}
|
||||
|
||||
void kinc_window_hide(int window_index) {}
|
||||
|
||||
void kinc_window_set_foreground(int window_index) {}
|
||||
|
||||
// TODO: change browser title.
|
||||
void kinc_window_set_title(int window_index, const char *title) {}
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ struct linux_procs {
|
||||
int (*window_display)(int window_index);
|
||||
void (*window_show)(int window_index);
|
||||
void (*window_hide)(int window_index);
|
||||
void (*window_set_foreground)(int window_index);
|
||||
void (*window_set_title)(int window_index, const char *title);
|
||||
void (*window_change_mode)(int window_index, kinc_window_mode_t mode);
|
||||
kinc_window_mode_t (*window_get_mode)(int window_index);
|
||||
|
||||
@ -59,6 +59,7 @@ void kinc_linux_init_procs() {
|
||||
procs.window_resize = kinc_wayland_window_resize;
|
||||
procs.window_show = kinc_wayland_window_show;
|
||||
procs.window_hide = kinc_wayland_window_hide;
|
||||
procs.window_set_foreground = kinc_wayland_window_set_foreground;
|
||||
procs.count_windows = kinc_wayland_count_windows;
|
||||
|
||||
procs.mouse_can_lock = kinc_wl_mouse_can_lock;
|
||||
@ -111,6 +112,7 @@ void kinc_linux_init_procs() {
|
||||
procs.window_resize = kinc_x11_window_resize;
|
||||
procs.window_show = kinc_x11_window_show;
|
||||
procs.window_hide = kinc_x11_window_hide;
|
||||
procs.window_set_foreground = kinc_x11_window_set_foreground;
|
||||
procs.count_windows = kinc_x11_count_windows;
|
||||
|
||||
procs.display_init = kinc_x11_display_init;
|
||||
|
||||
@ -499,6 +499,10 @@ void kinc_wayland_window_hide(int window_index) {
|
||||
kinc_log(KINC_LOG_LEVEL_ERROR, "Wayland does not support hiding windows.");
|
||||
}
|
||||
|
||||
void kinc_wayland_window_set_foreground(int window_index) {
|
||||
kinc_log(KINC_LOG_LEVEL_ERROR, "Wayland does not support activating windows.");
|
||||
}
|
||||
|
||||
kinc_window_mode_t kinc_wayland_window_get_mode(int window_index) {
|
||||
return wl_ctx.windows[window_index].mode;
|
||||
}
|
||||
|
||||
@ -80,6 +80,10 @@ void kinc_window_hide(int window_index) {
|
||||
procs.window_hide(window_index);
|
||||
}
|
||||
|
||||
void kinc_window_set_foreground(int window_index) {
|
||||
procs.window_set_foreground(window_index);
|
||||
}
|
||||
|
||||
void kinc_window_set_title(int window_index, const char *title) {
|
||||
procs.window_set_title(window_index, title);
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ struct MwmHints {
|
||||
#define MWM_HINTS_DECORATIONS (1L << 1)
|
||||
|
||||
void kinc_x11_window_set_title(int window_index, const char *title);
|
||||
void kinc_x11_window_set_foreground(int window_index);
|
||||
void kinc_x11_window_change_mode(int window_index, kinc_window_mode_t mode);
|
||||
|
||||
int kinc_x11_window_create(kinc_window_options_t *win, kinc_framebuffer_options_t *frame) {
|
||||
@ -145,6 +146,16 @@ void kinc_x11_window_hide(int window_index) {
|
||||
xlib.XUnmapWindow(x11_ctx.display, window->window);
|
||||
}
|
||||
|
||||
void kinc_x11_window_set_foreground(int window_index) {
|
||||
struct kinc_x11_window *window = &x11_ctx.windows[window_index];
|
||||
if (window->window == None) {
|
||||
return;
|
||||
}
|
||||
xlib.XRaiseWindow(x11_ctx.display, window->window);
|
||||
xlib.XSetInputFocus(x11_ctx.display, window->window, RevertToParent, CurrentTime);
|
||||
xlib.XFlush(x11_ctx.display);
|
||||
}
|
||||
|
||||
kinc_window_mode_t kinc_x11_window_get_mode(int window_index) {
|
||||
return x11_ctx.windows[window_index].mode;
|
||||
}
|
||||
|
||||
@ -63,6 +63,8 @@ void kinc_window_show(int window_index) {}
|
||||
|
||||
void kinc_window_hide(int window_index) {}
|
||||
|
||||
void kinc_window_set_foreground(int window_index) {}
|
||||
|
||||
// TODO: change browser title.
|
||||
void kinc_window_set_title(int window_index, const char *title) {}
|
||||
|
||||
|
||||
@ -392,6 +392,11 @@ void kinc_window_hide(int window_index) {
|
||||
UpdateWindow(windows[window_index].handle);
|
||||
}
|
||||
|
||||
void kinc_window_set_foreground(int window_index) {
|
||||
SetForegroundWindow(windows[window_index].handle);
|
||||
SetFocus(windows[window_index].handle);
|
||||
}
|
||||
|
||||
void kinc_window_set_title(int window_index, const char *title) {
|
||||
wchar_t buffer[1024];
|
||||
MultiByteToWideChar(CP_UTF8, 0, title, -1, buffer, 1024);
|
||||
|
||||
@ -41,6 +41,8 @@ void kinc_window_show(int window) {}
|
||||
|
||||
void kinc_window_hide(int window) {}
|
||||
|
||||
void kinc_window_set_foreground(int window) {}
|
||||
|
||||
void kinc_window_set_title(int window, const char *title) {}
|
||||
|
||||
int kinc_window_create(kinc_window_options_t *win, kinc_framebuffer_options_t *frame) {
|
||||
|
||||
@ -46,6 +46,8 @@ void kinc_window_show(int window) {}
|
||||
|
||||
void kinc_window_hide(int window) {}
|
||||
|
||||
void kinc_window_set_foreground(int window) {}
|
||||
|
||||
void kinc_window_set_title(int window, const char *title) {}
|
||||
|
||||
int kinc_window_create(kinc_window_options_t *win, kinc_framebuffer_options_t *frame) {
|
||||
|
||||
@ -139,6 +139,11 @@ KINC_FUNC void kinc_window_show(int window);
|
||||
/// </summary>
|
||||
KINC_FUNC void kinc_window_hide(int window);
|
||||
|
||||
/// <summary>
|
||||
/// Brings a window to the foreground and sets focus to it.
|
||||
/// </summary>
|
||||
KINC_FUNC void kinc_window_set_foreground(int window);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the title of a window.
|
||||
/// </summary>
|
||||
|
||||
@ -2708,7 +2708,7 @@ namespace {
|
||||
void runt_window_set_foreground(const FunctionCallbackInfo<Value> &args) {
|
||||
HandleScope scope(args.GetIsolate());
|
||||
int windowId = args[0]->ToInt32(isolate->GetCurrentContext()).ToLocalChecked()->Value();
|
||||
// kinc_window_set_foreground(windowId); // TODO: add to Kore
|
||||
kinc_window_set_foreground(windowId);
|
||||
}
|
||||
|
||||
#define SET_FUNCTION_FAST(object, name, fn)\
|
||||
@ -4038,7 +4038,7 @@ int kickstart(int argc, char **argv) {
|
||||
|
||||
start_runt(snapshot_found ? NULL : code);
|
||||
|
||||
#ifdef WITH_NETWORKING
|
||||
#ifdef WITH_VIEWPORT
|
||||
if (viewport_server_mode) {
|
||||
kinc_log(KINC_LOG_LEVEL_INFO, "Initializing viewport server: %dx%d, shmem=%s",
|
||||
viewport_width, viewport_height, viewport_shmem_name);
|
||||
|
||||
Reference in New Issue
Block a user