repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-derive/src/lib.rs | druid-derive/src/lib.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! derive macros for Druid.
#![deny(clippy::trivially_copy_pass_by_ref)]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/linebender/druid/screenshots/images/doc_logo.png"
)]
extern crate proc_macro;
mod attr;
mod data;
mod le... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-derive/src/data.rs | druid-derive/src/data.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! The implementation for #[derive(Data)]
use crate::attr::{DataAttr, Field, FieldKind, Fields};
use quote::{quote, quote_spanned};
use syn::{spanned::Spanned, Data, DataEnum, DataStruct};
pub(crate) fn derive_data_impl(
input: syn::Der... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-derive/src/lens.rs | druid-derive/src/lens.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use super::attr::{FieldKind, Fields, LensAttrs};
use proc_macro2::{Ident, Span};
use quote::quote;
use std::collections::HashSet;
use syn::{spanned::Spanned, Data, GenericParam, TypeParam};
pub(crate) fn derive_lens_impl(
input: syn::Deriv... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-derive/tests/ignore.rs | druid-derive/tests/ignore.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! testing the ignore attribute
use druid::Data;
#[test]
fn simple_ignore() {
#[derive(Clone, Data)]
struct Point {
x: f64,
#[data(ignore)]
#[allow(dead_code)]
y: f64,
}
let p1 = Point { x: 0.0... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-derive/tests/with_lens.rs | druid-derive/tests/with_lens.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use float_cmp::assert_approx_eq;
use druid::Data;
use druid::Lens;
#[test]
fn derive_lens() {
#[derive(Lens)]
struct State {
text: String,
#[lens(name = "lens_number")]
number: f64,
#[lens(ignore)]
... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-derive/tests/with_same.rs | druid-derive/tests/with_same.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use druid::Data;
#[test]
fn same_fn() {
#[derive(Clone, Data)]
struct Nanana {
bits: f64,
#[data(eq)]
peq: f64,
}
let one = Nanana {
bits: 1.0,
peq: f64::NAN,
};
let two = Nanana... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-derive/tests/lens_generic.rs | druid-derive/tests/lens_generic.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use druid::{Lens, LensExt};
use std::fmt::Debug;
use std::marker::PhantomData;
#[derive(Lens)]
struct Wrapper<T> {
x: T,
}
#[test]
fn one_plain_param() {
let wrap = Wrapper::<u64> { x: 45 };
let val = Wrapper::<u64>::x.with(&wrap,... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-derive/tests/ui.rs | druid-derive/tests/ui.rs | // Copyright 2021 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
// https://github.com/dtolnay/trybuild
// trybuild is a crate that essentially runs cargo on the provided files, and checks the output.
// Tests may suddenly fail after a new compiler release, and there's not much we can do about that.
// If th... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-derive/tests/data.rs | druid-derive/tests/data.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Test #[derive(Data)]
use druid::Data;
#[derive(Data, Clone)]
struct PlainStruct;
#[derive(Data, Clone)]
struct EmptyTupleStruct();
#[derive(Data, Clone)]
struct SingleTupleStruct(bool);
#[derive(Data, Clone)]
struct MultiTupleStruct(b... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-derive/tests/ui/with-empty-struct.rs | druid-derive/tests/ui/with-empty-struct.rs | use druid::*;
#[derive(Lens)]
struct Foobar;
fn main() {}
| rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-derive/tests/ui/with-union.rs | druid-derive/tests/ui/with-union.rs | use druid::*;
#[derive(Lens)]
union Foobar {
foo: i32,
bar: f64,
}
fn main() {}
| rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-derive/tests/ui/simple-lens.rs | druid-derive/tests/ui/simple-lens.rs | use druid::*;
#[derive(Lens)]
struct MyThing {
field_1: i32,
field_2: String,
}
fn main() {
let _ = MyThing::field_1;
let _ = MyThing::field_2;
}
| rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-derive/tests/ui/with-snake_case.rs | druid-derive/tests/ui/with-snake_case.rs | #![allow(non_camel_case_types)]
use druid::*;
#[derive(Lens)]
struct my_thing {
field: i32
}
fn main() {}
| rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-derive/tests/ui/with-enum.rs | druid-derive/tests/ui/with-enum.rs | use druid::*;
#[derive(Lens)]
enum Foobar {
Foo(i32),
Bar,
}
fn main() {}
| rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-derive/tests/ui/with-tuple-struct.rs | druid-derive/tests/ui/with-tuple-struct.rs | use druid::*;
#[derive(Lens)]
struct Foobar(i32, i64);
fn main() {}
| rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-derive/tests/ui/lens-attributes.rs | druid-derive/tests/ui/lens-attributes.rs | #![allow(dead_code)]
use druid::*;
#[derive(Lens)]
struct Item {
#[lens(name = "count_lens")]
count: usize,
#[lens(ignore)]
complete: bool,
}
impl Item {
fn count(&self) -> usize {
self.count
}
fn complete(&mut self) {
self.complete = true;
}
}
fn main() {}
| rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/build.rs | druid-shell/build.rs | // Copyright 2021 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
#[cfg(not(any(feature = "x11", feature = "wayland")))]
fn main() {}
#[cfg(any(feature = "x11", feature = "wayland"))]
fn main() {
use pkg_config::probe_library;
use std::env;
use std::path::PathBuf;
if env::var("CARGO_CFG_TARG... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/lib.rs | druid-shell/src/lib.rs | // Copyright 2018 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Platform abstraction for Druid toolkit.
//!
//! `druid-shell` is an abstraction around a given platform UI & application
//! framework. It provides common types, which then defer to a platform-defined
//! implementation.
//!
//! # Env
//!
/... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/region.rs | druid-shell/src/region.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use crate::kurbo::{BezPath, Point, Rect, Shape, Vec2};
/// A union of rectangles, useful for describing an area that needs to be repainted.
#[derive(Clone, Debug)]
pub struct Region {
rects: Vec<Rect>,
}
impl Region {
/// The empty re... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/mouse.rs | druid-shell/src/mouse.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Common types for representing mouse events and state
use crate::backend;
use crate::kurbo::{Point, Vec2};
use crate::piet::ImageBuf;
use crate::Modifiers;
/// Information about the mouse event.
///
/// Every mouse event can have a new pos... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/dialog.rs | druid-shell/src/dialog.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! File open/save dialogs.
use std::path::{Path, PathBuf};
/// Information about the path to be opened or saved.
///
/// This path might point to a file or a directory.
#[derive(Debug, Clone)]
pub struct FileInfo {
/// The path to the se... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/clipboard.rs | druid-shell/src/clipboard.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Interacting with the system pasteboard/clipboard.
pub use crate::backend::clipboard as backend;
/// A handle to the system clipboard.
///
/// To get access to the global clipboard, call [`Application::clipboard`].
///
///
/// # Working wit... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/menu.rs | druid-shell/src/menu.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use crate::backend::menu as backend;
use crate::hotkey::HotKey;
/// A menu object.
///
/// This may be a window menu, an application menu (macOS) or a context (right-click)
/// menu.
///
/// # Configuring menus
///
/// Currently, a menu and it... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/text.rs | druid-shell/src/text.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Types and functions for cross-platform text input.
//!
//! Text input is a notoriously difficult problem. Unlike many other aspects of
//! user interfaces, text input can not be correctly modeled using discrete
//! events passed from the p... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | true |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/error.rs | druid-shell/src/error.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Errors at the application shell level.
use std::fmt;
use std::sync::Arc;
use crate::backend::error as backend;
/// Shell errors.
#[derive(Debug, Clone)]
pub enum Error {
/// The Application instance has already been created.
Appl... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/application.rs | druid-shell/src/application.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! The top-level application type.
use std::cell::RefCell;
use std::rc::Rc;
use std::sync::atomic::{AtomicBool, Ordering};
use crate::backend::application as backend;
use crate::clipboard::Clipboard;
use crate::error::Error;
use crate::util;... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/scale.rs | druid-shell/src/scale.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Resolution scale related helpers.
use crate::kurbo::{Insets, Line, Point, Rect, Size, Vec2};
/// Coordinate scaling between pixels and display points.
///
/// This holds the platform scale factors.
///
/// ## Pixels and Display Points
///... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/util.rs | druid-shell/src/util.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Utility functions for determining the main thread.
use std::mem;
use std::sync::atomic::{AtomicU64, Ordering};
use std::thread;
static MAIN_THREAD_ID: AtomicU64 = AtomicU64::new(0);
#[inline]
fn current_thread_id() -> u64 {
// TODO: ... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/hotkey.rs | druid-shell/src/hotkey.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Hotkeys and helpers for parsing keyboard shortcuts.
use std::borrow::Borrow;
use tracing::warn;
use crate::{IntoKey, KbKey, KeyEvent, Modifiers};
// TODO: fix docstring
/// A description of a keyboard shortcut.
///
/// This type is onl... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/window.rs | druid-shell/src/window.rs | // Copyright 2018 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Platform independent window types.
use std::any::Any;
use std::time::Duration;
use crate::application::Application;
use crate::backend::window as backend;
use crate::common_util::Counter;
use crate::dialog::{FileDialogOptions, FileInfo};
... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/common_util.rs | druid-shell/src/common_util.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Common functions used by the backends
use std::cell::Cell;
use std::num::NonZeroU64;
use std::sync::atomic::{AtomicU64, Ordering};
use std::time::Duration;
use instant::Instant;
use crate::kurbo::Point;
use crate::WinHandler;
// This is... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/keyboard.rs | druid-shell/src/keyboard.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Keyboard types.
// This is a reasonable lint, but we keep signatures in sync with the
// bitflags implementation of the inner Modifiers type.
#![allow(clippy::trivially_copy_pass_by_ref)]
use std::ops::{BitAnd, BitAndAssign, BitOr, BitOrA... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/screen.rs | druid-shell/src/screen.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Module to get information about monitors
use crate::backend;
use crate::kurbo::Rect;
use std::fmt;
use std::fmt::Display;
/// Monitor struct containing data about a monitor on the system
///
/// Use [`Screen::get_monitors`] to return a `V... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/mod.rs | druid-shell/src/backend/mod.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Platform specific implementations.
// It would be clearer to use cfg_if! macros here, but that breaks rustfmt.
#[cfg(target_os = "windows")]
mod windows;
#[cfg(target_os = "windows")]
pub use windows::*;
#[cfg(target_os = "macos")]
mod m... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/x11/dialog.rs | druid-shell/src/backend/x11/dialog.rs | // Copyright 2022 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! This module contains functions for opening file dialogs using DBus.
use ashpd::desktop::file_chooser;
use ashpd::{zbus, WindowIdentifier};
use futures::executor::block_on;
use tracing::warn;
use crate::{FileDialogOptions, FileDialogToken,... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/x11/clipboard.rs | druid-shell/src/backend/x11/clipboard.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Interactions with the system pasteboard on X11.
use std::cell::{Cell, RefCell};
use std::collections::VecDeque;
use std::convert::TryFrom;
use std::rc::Rc;
use std::time::{Duration, Instant};
use x11rb::connection::{Connection, RequestCon... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/x11/menu.rs | druid-shell/src/backend/x11/menu.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! X11 menus implementation.
use crate::hotkey::HotKey;
pub struct Menu;
impl Menu {
pub fn new() -> Menu {
// TODO(x11/menus): implement Menu::new (currently a no-op)
tracing::warn!("Menu::new is currently unimplemented... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/x11/error.rs | druid-shell/src/backend/x11/error.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Errors at the application shell level.
use std::fmt;
use std::sync::Arc;
#[derive(Debug, Clone)]
pub enum Error {
XError(Arc<x11rb::errors::ReplyError>),
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> Re... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/x11/application.rs | druid-shell/src/backend/x11/application.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! X11 implementation of features at the application scope.
use std::cell::{Cell, RefCell};
use std::collections::{HashMap, VecDeque};
use std::convert::{TryFrom, TryInto};
use std::os::unix::io::RawFd;
use std::rc::Rc;
use std::time::{Durati... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | true |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/x11/util.rs | druid-shell/src/backend/x11/util.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Miscellaneous utility functions for working with X11.
use std::rc::Rc;
use anyhow::{anyhow, Error};
use x11rb::connection::RequestConnection;
use x11rb::errors::ReplyError;
use x11rb::protocol::randr::{ConnectionExt, ModeFlag};
use x11rb:... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/x11/mod.rs | druid-shell/src/backend/x11/mod.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! X11 implementation of `druid-shell`.
// TODO(x11/render_improvements): screen is currently flashing when resizing in perftest.
// Might be related to the "sleep scheduler" in XWindow::render()?
// TODO(x11/render_improvements): double-... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/x11/window.rs | druid-shell/src/backend/x11/window.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! X11 window creation and window management.
use std::cell::{Cell, RefCell};
use std::collections::BinaryHeap;
use std::convert::{TryFrom, TryInto};
use std::os::unix::io::RawFd;
use std::panic::Location;
use std::rc::{Rc, Weak};
use std::sy... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | true |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/x11/screen.rs | druid-shell/src/backend/x11/screen.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! X11 Monitors and Screen information.
use x11rb::connection::Connection;
use x11rb::errors::ReplyOrIdError;
use x11rb::protocol::randr::{self, ConnectionExt as _, Crtc};
use x11rb::protocol::xproto::{Screen, Timestamp};
use crate::kurbo::R... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/gtk/keycodes.rs | druid-shell/src/backend/gtk/keycodes.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! GTK code handling.
use gtk::gdk::keys::constants::*;
pub use super::super::shared::hardware_keycode_to_code;
use crate::keyboard_types::{Key, Location};
pub type RawKey = gtk::gdk::keys::Key;
#[allow(clippy::just_underscores_and_digits,... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/gtk/dialog.rs | druid-shell/src/backend/gtk/dialog.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! File open/save dialogs, GTK implementation.
use std::ffi::OsString;
use anyhow::anyhow;
use gtk::{FileChooserAction, FileFilter, ResponseType, Window};
use gtk::prelude::{FileChooserExt, NativeDialogExt};
use crate::dialog::{FileDialogO... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/gtk/clipboard.rs | druid-shell/src/backend/gtk/clipboard.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Interactions with the system pasteboard on GTK+.
use gtk::gdk::Atom;
use gtk::{TargetEntry, TargetFlags};
use crate::clipboard::{ClipboardFormat, FormatId};
const CLIPBOARD_TARGETS: [&str; 5] = [
"UTF8_STRING",
"TEXT",
"STRIN... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/gtk/menu.rs | druid-shell/src/backend/gtk/menu.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! GTK implementation of menus.
use gtk::gdk::ModifierType;
use gtk::{
AccelGroup, CheckMenuItem, Menu as GtkMenu, MenuBar as GtkMenuBar, MenuItem as GtkMenuItem,
};
use gtk_rs::SeparatorMenuItem;
use gtk::prelude::{GtkMenuExt, GtkMenuIt... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/gtk/error.rs | druid-shell/src/backend/gtk/error.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! GTK backend errors.
use std::fmt;
use gtk::glib::{BoolError, Error as GLibError};
/// GTK backend errors.
#[derive(Debug, Clone)]
pub enum Error {
/// Generic GTK error.
Error(GLibError),
/// GTK error that has no information... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/gtk/application.rs | druid-shell/src/backend/gtk/application.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! GTK implementation of features at the application scope.
use gtk::gio::prelude::ApplicationExtManual;
use gtk::gio::{ApplicationFlags, Cancellable};
use gtk::Application as GtkApplication;
use gtk::prelude::{ApplicationExt, GtkApplication... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/gtk/util.rs | druid-shell/src/backend/gtk/util.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Utilities, GTK specific.
pub(crate) fn assert_main_thread() {
assert!(gtk::is_initialized_main_thread());
}
| rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/gtk/mod.rs | druid-shell/src/backend/gtk/mod.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! GTK-based backend support
pub mod application;
pub mod clipboard;
pub mod dialog;
pub mod error;
pub mod keycodes;
pub mod menu;
pub mod screen;
pub mod util;
pub mod window;
| rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/gtk/window.rs | druid-shell/src/backend/gtk/window.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! GTK window creation and management.
use std::cell::{Cell, RefCell};
use std::convert::TryInto;
use std::ffi::c_void;
use std::os::raw::{c_int, c_uint};
use std::panic::Location;
use std::ptr;
use std::slice;
use std::sync::{Arc, Mutex, Wea... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | true |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/gtk/screen.rs | druid-shell/src/backend/gtk/screen.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! GTK Monitors and Screen information.
use crate::kurbo::{Point, Rect, Size};
use crate::screen::Monitor;
use gtk::gdk::{Display, DisplayManager, Rectangle};
use gtk::prelude::MonitorExt as _;
fn translate_gdk_rectangle(r: Rectangle) -> Rec... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/mac/dialog.rs | druid-shell/src/backend/mac/dialog.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! File open/save dialogs, macOS implementation.
#![allow(non_upper_case_globals, clippy::upper_case_acronyms)]
use std::ffi::OsString;
use cocoa::appkit::NSView;
use cocoa::base::{id, nil, NO, YES};
use cocoa::foundation::{NSArray, NSAutor... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/mac/clipboard.rs | druid-shell/src/backend/mac/clipboard.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Interactions with the system pasteboard on macOS.
use cocoa::appkit::NSPasteboardTypeString;
use cocoa::base::{id, nil, BOOL, YES};
use cocoa::foundation::{NSArray, NSInteger, NSUInteger};
use objc::{class, msg_send, sel, sel_impl};
use s... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/mac/text_input.rs | druid-shell/src/backend/mac/text_input.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
// massive thanks to github.com/yvt and their project tcw3 (https://github.com/yvt/Stella2), which is some
// of the most solid/well documented input method code for mac written in Rust that we've found. tcw3 was
// instrumental in this file's ... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/mac/menu.rs | druid-shell/src/backend/mac/menu.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! macOS implementation of menus.
use cocoa::appkit::{NSEventModifierFlags, NSMenu, NSMenuItem};
use cocoa::base::{id, nil, NO};
use cocoa::foundation::{NSAutoreleasePool, NSString};
use objc::{msg_send, sel, sel_impl};
use super::util::make... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/mac/error.rs | druid-shell/src/backend/mac/error.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! macOS backend errors.
//TODO: add a backend error for macOS, based on NSError
#[derive(Debug, Clone)]
pub struct Error;
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/mac/application.rs | druid-shell/src/backend/mac/application.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! macOS implementation of features at the application scope.
#![allow(non_upper_case_globals)]
use std::cell::RefCell;
use std::ffi::c_void;
use std::rc::Rc;
use std::sync::Once;
use cocoa::appkit::{NSApp, NSApplication, NSApplicationActiv... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/mac/util.rs | druid-shell/src/backend/mac/util.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Utilities, macOS specific.
use std::ffi::c_void;
use cocoa::base::{id, nil, BOOL, YES};
use cocoa::foundation::{NSAutoreleasePool, NSString, NSUInteger};
use objc::{class, msg_send, sel, sel_impl};
/// Panic if not on the main thread.
//... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/mac/mod.rs | druid-shell/src/backend/mac/mod.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! macOS `druid-shell` backend.
#![allow(clippy::let_unit_value)]
pub mod appkit;
pub mod application;
pub mod clipboard;
pub mod dialog;
pub mod error;
mod keyboard;
pub mod menu;
pub mod screen;
pub mod text_input;
pub mod util;
pub mod wi... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/mac/window.rs | druid-shell/src/backend/mac/window.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! macOS implementation of window creation.
#![allow(non_snake_case)]
use std::ffi::c_void;
use std::mem;
use std::sync::{Arc, Mutex, Weak};
use std::time::Instant;
use block::ConcreteBlock;
use cocoa::appkit::{
CGFloat, NSApp, NSApplic... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | true |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/mac/keyboard.rs | druid-shell/src/backend/mac/keyboard.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Conversion of backend keyboard event into cross-platform event.
use cocoa::appkit::{NSEvent, NSEventModifierFlags, NSEventType};
use cocoa::base::id;
use objc::{msg_send, sel, sel_impl};
use crate::keyboard::{Code, KbKey, KeyEvent, KeySta... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/mac/appkit.rs | druid-shell/src/backend/mac/appkit.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! macOS AppKit bindings.
#![allow(clippy::upper_case_acronyms, non_snake_case, non_upper_case_globals)]
use bitflags::bitflags;
use cocoa::base::id;
use cocoa::foundation::NSRect;
use objc::{class, msg_send, sel, sel_impl};
#[link(name = "... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/mac/screen.rs | druid-shell/src/backend/mac/screen.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! macOS Monitors and Screen information.
use crate::kurbo::Rect;
use crate::screen::Monitor;
use cocoa::appkit::NSScreen;
use cocoa::base::id;
use cocoa::foundation::NSArray;
use objc::{class, msg_send, sel, sel_impl};
pub(crate) fn get_mon... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/wayland/pointers.rs | druid-shell/src/backend/wayland/pointers.rs | // Copyright 2022 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use std::collections::VecDeque;
use wayland_client::protocol::wl_pointer;
use wayland_client::protocol::wl_surface::{self, WlSurface};
use wayland_client::{self as wl};
use wayland_cursor::CursorImageBuffer;
use wayland_cursor::CursorTheme;
us... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/wayland/clipboard.rs | druid-shell/src/backend/wayland/clipboard.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Interactions with the system pasteboard on wayland compositors.
use super::application;
use super::error as waylanderr;
use crate::clipboard::{ClipboardFormat, FormatId};
use std::io::Read;
use wayland_client as wl;
use wayland_client::prot... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/wayland/menu.rs | druid-shell/src/backend/wayland/menu.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
#![allow(unused)]
use super::window::WindowHandle;
use crate::common_util::strip_access_key;
use crate::hotkey::{HotKey, RawMods};
use crate::keyboard::{KbKey, Modifiers};
#[derive(Default, Debug)]
pub struct Menu;
#[derive(Debug)]
struct Men... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/wayland/error.rs | druid-shell/src/backend/wayland/error.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! wayland platform errors.
use std::{error::Error as StdError, fmt, sync::Arc};
use wayland_client as wl;
#[derive(Debug, Clone)]
pub enum Error {
/// Error connecting to wayland server.
Connect(Arc<wl::ConnectError>),
/// A way... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/wayland/application.rs | druid-shell/src/backend/wayland/application.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
#![allow(clippy::single_match)]
use super::{
clipboard, display, error::Error, events::WaylandSource, keyboard, outputs, pointers, surfaces,
window::WindowHandle,
};
use crate::{backend, mouse, AppHandler, TimerToken};
use calloop;
... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/wayland/display.rs | druid-shell/src/backend/wayland/display.rs | // Copyright 2022 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
#![allow(clippy::single_match)]
use super::error;
use std::collections::BTreeMap;
use wayland_client as wlc;
use wayland_client::protocol::wl_registry;
use wayland_protocols::xdg_shell::client::xdg_wm_base;
type GlobalEventConsumer = dyn Fn(&w... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/wayland/mod.rs | druid-shell/src/backend/wayland/mod.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! wayland platform support
// TODO: Remove this and fix the non-Send/Sync Arc issues
#![allow(clippy::arc_with_non_send_sync)]
pub mod application;
pub mod clipboard;
mod display;
pub mod error;
mod events;
pub mod keyboard;
pub mod menu;
m... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/wayland/window.rs | druid-shell/src/backend/wayland/window.rs | // Copyright 2022 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
#![allow(clippy::single_match)]
use tracing;
use wayland_protocols::xdg_shell::client::xdg_popup;
use wayland_protocols::xdg_shell::client::xdg_positioner;
use wayland_protocols::xdg_shell::client::xdg_surface;
#[cfg(feature = "raw-win-handle... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/wayland/events.rs | druid-shell/src/backend/wayland/events.rs | // Copyright 2022 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Multiplexing events.
//!
//! Calloop is a wrapper around `epoll` essentially allowing us to *select* multiple file
//! descriptors. We use it here to select events from a timer and from wayland.
//!
//! Based on `client-toolkit/src/event_lo... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/wayland/keyboard.rs | druid-shell/src/backend/wayland/keyboard.rs | // Copyright 2022 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use std::convert::TryInto;
use wayland_client as wlc;
use wayland_client::protocol::wl_keyboard;
use wayland_client::protocol::wl_seat;
use crate::keyboard_types::KeyState;
use crate::text;
use crate::KeyEvent;
use crate::Modifiers;
use super... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/wayland/screen.rs | druid-shell/src/backend/wayland/screen.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! wayland Monitors and Screen information.
use crate::kurbo::Rect;
use crate::screen::Monitor;
use super::error;
use super::outputs;
fn _get_monitors() -> Result<Vec<Monitor>, error::Error> {
let metas = outputs::current()?;
let m... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/wayland/outputs/mod.rs | druid-shell/src/backend/wayland/outputs/mod.rs | // Copyright 2022 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use wayland_client as wlc;
use wayland_client::protocol::wl_output;
use super::display;
use super::error;
pub mod output;
#[derive(Debug, Clone)]
#[allow(unused)]
pub enum Event {
Located(Meta),
Removed(Meta),
}
pub fn auto(
env:... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/wayland/outputs/output.rs | druid-shell/src/backend/wayland/outputs/output.rs | // Copyright 2022 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use super::super::display;
use super::super::error;
use super::super::outputs;
use wayland_client as wlc;
use wayland_client::protocol::wl_output;
use wayland_client::protocol::wl_registry;
use wayland_protocols::unstable::xdg_output::v1::clien... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/wayland/surfaces/buffers.rs | druid-shell/src/backend/wayland/surfaces/buffers.rs | // Copyright 2022 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use crate::kurbo::{Rect, Size};
use nix::{
errno::Errno,
fcntl::OFlag,
sys::{
mman::{mmap, munmap, shm_open, MapFlags, ProtFlags},
stat::Mode,
},
unistd::{close, ftruncate},
};
use std::{
cell::{Cell, Ref... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/wayland/surfaces/idle.rs | druid-shell/src/backend/wayland/surfaces/idle.rs | // Copyright 2022 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use crate::common_util::IdleCallback;
use crate::window;
/// This represents different Idle Callback Mechanism
pub(super) enum Kind {
Callback(Box<dyn IdleCallback>),
Token(window::IdleToken),
}
impl std::fmt::Debug for Kind {
fn ... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/wayland/surfaces/toplevel.rs | druid-shell/src/backend/wayland/surfaces/toplevel.rs | // Copyright 2022 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use wayland_client as wlc;
use wayland_protocols::xdg_shell::client::xdg_surface;
use wayland_protocols::xdg_shell::client::xdg_toplevel;
use crate::kurbo;
use crate::window;
use super::error;
use super::surface;
use super::Compositor;
use su... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/wayland/surfaces/surface.rs | druid-shell/src/backend/wayland/surfaces/surface.rs | // Copyright 2022 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use std::cell::{Cell, RefCell};
use std::rc::Rc;
use wayland_client as wlc;
use wayland_client::protocol::wl_surface;
use wayland_protocols::xdg_shell::client::xdg_popup;
use wayland_protocols::xdg_shell::client::xdg_positioner;
use wayland_pro... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/wayland/surfaces/layershell.rs | druid-shell/src/backend/wayland/surfaces/layershell.rs | // Copyright 2022 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use wayland_client as wlc;
use wayland_protocols::wlr::unstable::layer_shell::v1::client as layershell;
use wayland_protocols::xdg_shell::client::xdg_surface;
use crate::kurbo;
use crate::window;
use super::super::error;
use super::super::out... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/wayland/surfaces/mod.rs | druid-shell/src/backend/wayland/surfaces/mod.rs | // Copyright 2022 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use wayland_client::protocol::wl_shm::WlShm;
use wayland_client::{self as wlc, protocol::wl_region::WlRegion, protocol::wl_surface::WlSurface};
use wayland_protocols::wlr::unstable::layer_shell::v1::client::zwlr_layer_shell_v1::ZwlrLayerShellV1... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/wayland/surfaces/popup.rs | druid-shell/src/backend/wayland/surfaces/popup.rs | // Copyright 2022 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use wayland_client as wlc;
use wayland_protocols::xdg_shell::client::xdg_popup;
use wayland_protocols::xdg_shell::client::xdg_positioner;
use wayland_protocols::xdg_shell::client::xdg_surface;
use crate::kurbo;
use crate::window;
use super::e... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/windows/keycodes.rs | druid-shell/src/backend/windows/keycodes.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Windows keycode conversion.
use win_vks::*;
use winapi::um::winuser::*;
use crate::keycodes::KeyCode;
pub type RawKeyCode = i32;
mod win_vks {
//NOTE: Most keys on Windows have VK_ values defined in use winapi::um::winuser,
// b... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/windows/paint.rs | druid-shell/src/backend/windows/paint.rs | // Copyright 2017 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Bureaucracy to create render targets for painting.
//!
//! Note that these are currently implemented using hwnd render targets
//! because they are are (relatively) easy, but for high performance we want
//! dxgi render targets so we can us... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/windows/dialog.rs | druid-shell/src/backend/windows/dialog.rs | // Copyright 2018 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! File open/save dialogs, Windows implementation.
//!
//! For more information about how windows handles file dialogs, see
//! documentation for [_FILEOPENDIALOGOPTIONS] and [SetFileTypes].
//!
//! [_FILEOPENDIALOGOPTIONS]: https://docs.micro... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/windows/clipboard.rs | druid-shell/src/backend/windows/clipboard.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Interactions with the system pasteboard on Windows.
use std::ffi::CString;
use std::mem;
use std::ptr;
use winapi::shared::minwindef::{FALSE, UINT};
use winapi::shared::ntdef::{CHAR, HANDLE, LPWSTR, WCHAR};
use winapi::shared::winerror::E... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/windows/menu.rs | druid-shell/src/backend/windows/menu.rs | // Copyright 2018 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Safe wrapper for menus.
use std::collections::HashMap;
use std::fmt::Write as _;
use std::mem;
use std::ptr::null;
use winapi::shared::basetsd::*;
use winapi::shared::windef::*;
use winapi::um::winuser::*;
use super::util::ToWide;
use cr... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/windows/error.rs | druid-shell/src/backend/windows/error.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Errors at the application shell level.
use std::fmt;
use std::ptr::{null, null_mut};
use winapi::shared::minwindef::{DWORD, HLOCAL};
use winapi::shared::ntdef::LPWSTR;
use winapi::shared::winerror::HRESULT;
use winapi::um::winbase::{
... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/windows/application.rs | druid-shell/src/backend/windows/application.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Windows implementation of features at the application scope.
use std::cell::RefCell;
use std::collections::HashSet;
use std::mem;
use std::ptr;
use std::rc::Rc;
use std::sync::atomic::{AtomicBool, Ordering};
use winapi::shared::minwindef:... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/windows/util.rs | druid-shell/src/backend/windows/util.rs | // Copyright 2017 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Various utilities for working with windows. Includes utilities for converting between Windows
//! and Rust types, including strings.
//! Also includes some code to dynamically load functions at runtime. This is needed for functions
//! whic... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/windows/mod.rs | druid-shell/src/backend/windows/mod.rs | // Copyright 2018 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Windows implementation of `druid-shell`.
mod accels;
pub mod application;
pub mod clipboard;
pub mod dcomp;
pub mod dialog;
pub mod error;
mod keyboard;
pub mod menu;
pub mod paint;
pub mod screen;
mod timers;
pub mod util;
pub mod window;... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/windows/window.rs | druid-shell/src/backend/windows/window.rs | // Copyright 2018 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Creation and management of windows.
#![allow(non_snake_case, clippy::cast_lossless)]
use std::cell::{Cell, RefCell};
use std::mem;
use std::panic::Location;
use std::ptr::{null, null_mut};
use std::rc::{Rc, Weak};
use std::sync::{Arc, Mut... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | true |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/windows/accels.rs | druid-shell/src/backend/windows/accels.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Wrappers for Windows of Accelerate Table.
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
use once_cell::sync::Lazy;
use winapi::ctypes::c_int;
use winapi::shared::windef::*;
use winapi::um::winuser::*;
// NOTE:
// https://do... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/windows/dcomp.rs | druid-shell/src/backend/windows/dcomp.rs | // Copyright 2018 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Safe-ish wrappers for DirectComposition and related interfaces.
// This module could become a general wrapper for DirectComposition, but
// for now we're just using what we need to get a swapchain up.
use std::ptr::{null, null_mut};
use ... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/windows/keyboard.rs | druid-shell/src/backend/windows/keyboard.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Key event handling.
use std::cmp::Ordering;
use std::collections::{HashMap, HashSet};
use std::convert::TryInto;
use std::mem;
use std::ops::RangeInclusive;
use crate::keyboard::{Code, KbKey, KeyEvent, KeyState, Location, Modifiers};
use... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/windows/timers.rs | druid-shell/src/backend/windows/timers.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Timer state.
use std::collections::BTreeSet;
use std::time::Instant;
use crate::window::TimerToken;
pub struct TimerSlots {
// Note: we can remove this when checked_duration_since lands.
next_fresh_id: u64,
free_slots: BTreeS... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/windows/screen.rs | druid-shell/src/backend/windows/screen.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Windows Monitors and Screen information.
use super::error::Error;
use std::mem::size_of;
use std::ptr::null_mut;
use tracing::warn;
use winapi::shared::minwindef::*;
use winapi::shared::windef::*;
use winapi::shared::winerror::*;
use winap... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.