mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
* docs: document that getCursorScreenPoint() needs a Window on Wayland Co-authored-by: Charles Kerr <charles@charleskerr.com> * feat: add IsWayland() helper Co-authored-by: Charles Kerr <charles@charleskerr.com> * fix: Wayland crash in GetCursorScreenPoint() fix: support Screen::GetCursorScreenPoint() on X11 Co-authored-by: Charles Kerr <charles@charleskerr.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
31 lines
635 B
C++
31 lines
635 B
C++
// Copyright (c) 2025 Microsoft GmbH.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "shell/browser/linux/x11_util.h"
|
|
|
|
#include "build/build_config.h"
|
|
#include "ui/ozone/platform_selection.h" // nogncheck
|
|
|
|
namespace x11_util {
|
|
|
|
bool IsX11() {
|
|
#if BUILDFLAG(IS_LINUX)
|
|
static const bool is = ui::GetOzonePlatformId() == ui::kPlatformX11;
|
|
return is;
|
|
#else
|
|
return false;
|
|
#endif
|
|
}
|
|
|
|
bool IsWayland() {
|
|
#if BUILDFLAG(IS_LINUX)
|
|
static const bool is = ui::GetOzonePlatformId() == ui::kPlatformWayland;
|
|
return is;
|
|
#else
|
|
return false;
|
|
#endif
|
|
}
|
|
|
|
} // namespace x11_util
|