file_path
stringlengths
3
280
file_language
stringclasses
66 values
content
stringlengths
1
1.04M
repo_name
stringlengths
5
92
repo_stars
int64
0
154k
repo_description
stringlengths
0
402
repo_primary_language
stringclasses
108 values
developer_username
stringlengths
1
25
developer_name
stringlengths
0
30
developer_company
stringlengths
0
82
src/platform/unix.rs
Rust
use glib::IsA; use crate::{ event_loop::EventLoopWindowTarget, platform_impl::ApplicationName, window::{Window, WindowBuilder}, }; pub use crate::platform_impl::hit_test; /// Additional methods on `Window` that are specific to Unix. pub trait WindowExtUnix { /// Returns the `gtk::ApplicatonWindow` fr...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform/wayland.rs
Rust
use std::os::raw; use crate::{ event_loop::{EventLoopBuilder, EventLoopWindowTarget}, monitor::MonitorHandle, window::{Window, WindowBuilder}, }; use crate::platform_impl::{ ApplicationName, Backend, EventLoopWindowTarget as LinuxEventLoopWindowTarget, Window as LinuxWindow, }; pub use crate::win...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform/web.rs
Rust
//! The web target does not automatically insert the canvas element object into the web page, to //! allow end users to determine how the page should be laid out. Use the [`WindowExtWebSys`] trait //! to retrieve the canvas from the Window. Alternatively, use the [`WindowBuilderExtWebSys`] trait //! to provide your own...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform/windows.rs
Rust
use std::{ffi::c_void, path::Path}; use crate::{ dpi::PhysicalSize, event::DeviceId, event_loop::EventLoopBuilder, monitor::MonitorHandle, platform_impl::WinIcon, window::{BadIcon, Icon, Window, WindowBuilder}, }; /// Window Handle type used by Win32 API pub type HWND = isize; /// Menu Handle ...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform/x11.rs
Rust
use std::os::raw; use std::ptr; use crate::{ event_loop::{EventLoopBuilder, EventLoopWindowTarget}, monitor::MonitorHandle, window::{Window, WindowBuilder}, }; use crate::dpi::Size; use crate::platform_impl::{ x11::ffi::XVisualInfo, ApplicationName, Backend, Window as LinuxWindow, XLIB_ERROR_HOOKS, };...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/android/mod.rs
Rust
#![cfg(android_platform)] use std::{ collections::VecDeque, hash::Hash, sync::{ atomic::{AtomicBool, Ordering}, mpsc, Arc, RwLock, }, time::{Duration, Instant}, }; use android_activity::input::{InputEvent, KeyAction, Keycode, MotionAction}; use android_activity::{ AndroidApp, A...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/ios/app_state.rs
Rust
#![deny(unused_results)] use std::{ cell::{RefCell, RefMut}, collections::HashSet, mem, os::raw::c_void, ptr, time::Instant, }; use core_foundation::base::CFRelease; use core_foundation::date::CFAbsoluteTimeGetCurrent; use core_foundation::runloop::{ kCFRunLoopCommonModes, CFRunLoopAddTime...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/ios/event_loop.rs
Rust
use std::{ collections::VecDeque, ffi::c_void, fmt::{self, Debug}, marker::PhantomData, ptr, sync::mpsc::{self, Receiver, Sender}, }; use core_foundation::base::{CFIndex, CFRelease}; use core_foundation::runloop::{ kCFRunLoopAfterWaiting, kCFRunLoopBeforeWaiting, kCFRunLoopCommonModes, kCFR...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/ios/ffi.rs
Rust
#![allow(non_camel_case_types, non_snake_case, non_upper_case_globals)] use std::convert::TryInto; use objc2::encode::{Encode, Encoding}; use objc2::foundation::{NSInteger, NSUInteger}; use crate::platform::ios::{Idiom, ScreenEdge}; #[repr(C)] #[derive(Clone, Debug)] pub struct NSOperatingSystemVersion { pub ma...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/ios/mod.rs
Rust
//! iOS support //! //! # Building app //! To build ios app you will need rustc built for this targets: //! //! - armv7-apple-ios //! - armv7s-apple-ios //! - i386-apple-ios //! - aarch64-apple-ios //! - x86_64-apple-ios //! //! Then //! //! ``` //! cargo build --target=... //! ``` //! The simplest way to integrat...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/ios/monitor.rs
Rust
#![allow(clippy::unnecessary_cast)] use std::{ collections::{BTreeSet, VecDeque}, fmt, ops::{Deref, DerefMut}, }; use objc2::foundation::{MainThreadMarker, NSInteger}; use objc2::rc::{Id, Shared}; use super::uikit::{UIScreen, UIScreenMode}; use crate::{ dpi::{PhysicalPosition, PhysicalSize}, moni...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/ios/uikit/application.rs
Rust
use objc2::foundation::{CGRect, MainThreadMarker, NSArray, NSObject}; use objc2::rc::{Id, Shared}; use objc2::{extern_class, extern_methods, msg_send_id, ClassType}; use super::{UIResponder, UIWindow}; extern_class!( #[derive(Debug, PartialEq, Eq, Hash)] pub(crate) struct UIApplication; unsafe impl Class...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/ios/uikit/coordinate_space.rs
Rust
use objc2::foundation::NSObject; use objc2::{extern_class, ClassType}; extern_class!( #[derive(Debug, PartialEq, Eq, Hash)] pub(crate) struct UICoordinateSpace; unsafe impl ClassType for UICoordinateSpace { type Super = NSObject; } );
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/ios/uikit/device.rs
Rust
use objc2::foundation::{MainThreadMarker, NSObject}; use objc2::rc::{Id, Shared}; use objc2::{extern_class, extern_methods, msg_send_id, ClassType}; use super::super::ffi::UIUserInterfaceIdiom; extern_class!( #[derive(Debug, PartialEq, Eq, Hash)] pub(crate) struct UIDevice; unsafe impl ClassType for UIDe...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/ios/uikit/event.rs
Rust
use objc2::foundation::NSObject; use objc2::{extern_class, ClassType}; extern_class!( #[derive(Debug, PartialEq, Eq, Hash)] pub(crate) struct UIEvent; unsafe impl ClassType for UIEvent { type Super = NSObject; } );
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/ios/uikit/mod.rs
Rust
#![deny(unsafe_op_in_unsafe_fn)] #![allow(non_snake_case)] #![allow(non_upper_case_globals)] use std::os::raw::{c_char, c_int}; use objc2::foundation::NSString; mod application; mod coordinate_space; mod device; mod event; mod responder; mod screen; mod screen_mode; mod touch; mod trait_collection; mod view; mod vie...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/ios/uikit/responder.rs
Rust
use objc2::foundation::NSObject; use objc2::{extern_class, ClassType}; extern_class!( #[derive(Debug, PartialEq, Eq, Hash)] pub(crate) struct UIResponder; unsafe impl ClassType for UIResponder { type Super = NSObject; } );
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/ios/uikit/screen.rs
Rust
use objc2::encode::{Encode, Encoding}; use objc2::foundation::{CGFloat, CGRect, MainThreadMarker, NSArray, NSInteger, NSObject}; use objc2::rc::{Id, Shared}; use objc2::{extern_class, extern_methods, msg_send_id, ClassType}; use super::{UICoordinateSpace, UIScreenMode}; extern_class!( #[derive(Debug, PartialEq, E...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/ios/uikit/screen_mode.rs
Rust
use objc2::foundation::{CGSize, NSObject}; use objc2::{extern_class, extern_methods, ClassType}; extern_class!( #[derive(Debug, PartialEq, Eq, Hash)] pub(crate) struct UIScreenMode; unsafe impl ClassType for UIScreenMode { type Super = NSObject; } ); extern_methods!( unsafe impl UIScreenM...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/ios/uikit/touch.rs
Rust
use objc2::encode::{Encode, Encoding}; use objc2::foundation::{CGFloat, CGPoint, NSInteger, NSObject}; use objc2::{extern_class, extern_methods, ClassType}; use super::UIView; extern_class!( #[derive(Debug, PartialEq, Eq, Hash)] pub(crate) struct UITouch; unsafe impl ClassType for UITouch { type ...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/ios/uikit/trait_collection.rs
Rust
use objc2::encode::{Encode, Encoding}; use objc2::foundation::{NSInteger, NSObject}; use objc2::{extern_class, extern_methods, ClassType}; extern_class!( #[derive(Debug, PartialEq, Eq, Hash)] pub(crate) struct UITraitCollection; unsafe impl ClassType for UITraitCollection { type Super = NSObject; ...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/ios/uikit/view.rs
Rust
use objc2::encode::{Encode, Encoding}; use objc2::foundation::{CGFloat, CGRect, NSObject}; use objc2::rc::{Id, Shared}; use objc2::{extern_class, extern_methods, msg_send_id, ClassType}; use super::{UICoordinateSpace, UIResponder, UIViewController}; extern_class!( #[derive(Debug, PartialEq, Eq, Hash)] pub(cra...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/ios/uikit/view_controller.rs
Rust
use objc2::encode::{Encode, Encoding}; use objc2::foundation::{NSObject, NSUInteger}; use objc2::rc::{Id, Shared}; use objc2::{extern_class, extern_methods, msg_send_id, ClassType}; use super::{UIResponder, UIView}; extern_class!( #[derive(Debug, PartialEq, Eq, Hash)] pub(crate) struct UIViewController; ...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/ios/uikit/window.rs
Rust
use objc2::foundation::NSObject; use objc2::rc::{Id, Shared}; use objc2::{extern_class, extern_methods, msg_send_id, ClassType}; use super::{UIResponder, UIScreen, UIView}; extern_class!( #[derive(Debug, PartialEq, Eq, Hash)] pub(crate) struct UIWindow; unsafe impl ClassType for UIWindow { #[inhe...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/ios/view.rs
Rust
#![allow(clippy::unnecessary_cast)] use objc2::foundation::{CGFloat, CGRect, MainThreadMarker, NSObject, NSSet}; use objc2::rc::{Id, Shared}; use objc2::runtime::Class; use objc2::{declare_class, extern_methods, msg_send, msg_send_id, ClassType}; use super::uikit::{ UIApplication, UIDevice, UIEvent, UIForceTouchC...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/ios/window.rs
Rust
#![allow(clippy::unnecessary_cast)] use std::{ collections::VecDeque, ffi::c_void, ops::{Deref, DerefMut}, }; use objc2::foundation::{CGFloat, CGPoint, CGRect, CGSize, MainThreadMarker}; use objc2::rc::{Id, Shared}; use objc2::runtime::Object; use objc2::{class, msg_send}; use raw_window_handle::{RawDispl...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/linux/eventloop.rs
Rust
use std::{ cell::RefCell, collections::{HashSet, VecDeque}, process, rc::Rc, sync::atomic::{AtomicU32, Ordering}, time::Instant, }; use cairo::{RectangleInt, Region}; use crossbeam_channel::SendError; use gdk::{ prelude::{ApplicationExt, DisplayExtManual}, Cursor, CursorType, EventKey, ...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/linux/keyboard.rs
Rust
use gdk::{ keys::{constants::*, Key}, EventKey, ModifierType, }; use crate::event::{ModifiersState, VirtualKeyCode}; const MODIFIER_MAP: &[(ModifierType, ModifiersState)] = &[ (ModifierType::SHIFT_MASK, ModifiersState::SHIFT), (ModifierType::MOD1_MASK, ModifiersState::ALT), (ModifierType::CONTROL_...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/linux/mod.rs
Rust
#![cfg(free_unix)] use std::fmt; use crate::event::DeviceId as RootDeviceId; pub(crate) use crate::icon::RgbaIcon as PlatformIcon; use crate::platform_impl::Fullscreen; mod eventloop; mod keyboard; mod monitor; mod util; mod window; pub use eventloop::{EventLoop, EventLoopProxy, EventLoopWindowTarget}; use gdk_pix...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/linux/monitor.rs
Rust
use crate::dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize}; use gdk::prelude::MonitorExt; #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct MonitorHandle { pub(crate) monitor: gdk::Monitor, } impl MonitorHandle { pub fn new(display: &gdk::Display, number: i32) -> Self { ...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/linux/util.rs
Rust
use gtk::traits::{GtkWindowExt, WidgetExt}; use crate::dpi::{LogicalSize, Size}; pub fn set_size_constraints<W: GtkWindowExt + WidgetExt>( window: &W, min_size: Option<Size>, max_size: Option<Size>, ) { let mut geom_mask = gdk::WindowHints::empty(); if min_size.is_some() { geom_mask |= gdk...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/linux/window.rs
Rust
use std::{ cell::RefCell, collections::VecDeque, rc::Rc, sync::atomic::{AtomicBool, AtomicI32, Ordering}, }; use gdk::{prelude::DisplayExtManual, WindowEdge, WindowState}; use glib::{translate::ToGlibPtr, Cast, ObjectType}; use gtk::{ prelude::GtkSettingsExt, traits::{ApplicationWindowExt, Cont...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/app.rs
Rust
#![allow(clippy::unnecessary_cast)] use objc2::foundation::NSObject; use objc2::{declare_class, msg_send, ClassType}; use super::appkit::{NSApplication, NSEvent, NSEventModifierFlags, NSEventType, NSResponder}; use super::{app_state::AppState, event::EventWrapper, DEVICE_ID}; use crate::event::{DeviceEvent, ElementSt...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/app_delegate.rs
Rust
use objc2::foundation::NSObject; use objc2::rc::{Id, Shared}; use objc2::runtime::Object; use objc2::{declare_class, msg_send, msg_send_id, ClassType}; use super::app_state::AppState; use super::appkit::NSApplicationActivationPolicy; declare_class!( #[derive(Debug)] pub(super) struct ApplicationDelegate { ...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/app_state.rs
Rust
use std::{ cell::{RefCell, RefMut}, collections::VecDeque, fmt::{self, Debug}, mem, rc::{Rc, Weak}, sync::{ atomic::{AtomicBool, Ordering}, Mutex, MutexGuard, }, time::Instant, }; use core_foundation::runloop::{CFRunLoopGetMain, CFRunLoopWakeUp}; use objc2::foundation::{...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/appkit/appearance.rs
Rust
use objc2::foundation::{NSArray, NSObject, NSString}; use objc2::rc::{Id, Shared}; use objc2::{extern_class, extern_methods, msg_send_id, ClassType}; extern_class!( #[derive(Debug, PartialEq, Eq, Hash)] pub(crate) struct NSAppearance; unsafe impl ClassType for NSAppearance { type Super = NSObject;...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/appkit/application.rs
Rust
use objc2::foundation::{MainThreadMarker, NSArray, NSInteger, NSObject, NSUInteger}; use objc2::rc::{Id, Shared}; use objc2::runtime::Object; use objc2::{extern_class, extern_methods, msg_send_id, ClassType}; use objc2::{Encode, Encoding}; use super::{NSAppearance, NSEvent, NSMenu, NSResponder, NSWindow}; extern_clas...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/appkit/button.rs
Rust
use objc2::foundation::NSObject; use objc2::{extern_class, ClassType}; use super::{NSControl, NSResponder, NSView}; extern_class!( #[derive(Debug, PartialEq, Eq, Hash)] pub(crate) struct NSButton; unsafe impl ClassType for NSButton { #[inherits(NSView, NSResponder, NSObject)] type Super =...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/appkit/color.rs
Rust
use objc2::foundation::NSObject; use objc2::rc::{Id, Shared}; use objc2::{extern_class, extern_methods, msg_send_id, ClassType}; extern_class!( /// An object that stores color data and sometimes opacity (alpha value). /// /// <https://developer.apple.com/documentation/appkit/nscolor?language=objc> #[de...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/appkit/control.rs
Rust
use objc2::foundation::NSObject; use objc2::{extern_class, extern_methods, ClassType}; use super::{NSResponder, NSView}; extern_class!( #[derive(Debug, PartialEq, Eq, Hash)] pub(crate) struct NSControl; unsafe impl ClassType for NSControl { #[inherits(NSResponder, NSObject)] type Super = ...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/appkit/cursor.rs
Rust
use once_cell::sync::Lazy; use objc2::foundation::{NSData, NSDictionary, NSNumber, NSObject, NSPoint, NSString}; use objc2::rc::{DefaultId, Id, Shared}; use objc2::runtime::Sel; use objc2::{extern_class, extern_methods, msg_send_id, ns_string, sel, ClassType}; use super::NSImage; use crate::window::CursorIcon; exter...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/appkit/event.rs
Rust
use std::os::raw::c_ushort; use objc2::encode::{Encode, Encoding}; use objc2::foundation::{ CGFloat, NSCopying, NSInteger, NSObject, NSPoint, NSString, NSTimeInterval, NSUInteger, }; use objc2::rc::{Id, Shared}; use objc2::{extern_class, extern_methods, msg_send_id, ClassType}; extern_class!( #[derive(Debug, ...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/appkit/image.rs
Rust
use objc2::foundation::{NSData, NSObject, NSString}; use objc2::rc::{Id, Shared}; use objc2::{extern_class, extern_methods, msg_send_id, ClassType}; extern_class!( // TODO: Can this be mutable? #[derive(Debug, PartialEq, Eq, Hash)] pub(crate) struct NSImage; unsafe impl ClassType for NSImage { ...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/appkit/menu.rs
Rust
use objc2::foundation::NSObject; use objc2::rc::{Id, Shared}; use objc2::{extern_class, extern_methods, msg_send_id, ClassType}; use super::NSMenuItem; extern_class!( #[derive(Debug, PartialEq, Eq, Hash)] pub(crate) struct NSMenu; unsafe impl ClassType for NSMenu { type Super = NSObject; } );...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/appkit/menu_item.rs
Rust
use objc2::foundation::{NSObject, NSString}; use objc2::rc::{Id, Shared}; use objc2::runtime::Sel; use objc2::{extern_class, extern_methods, msg_send_id, ClassType}; use super::{NSEventModifierFlags, NSMenu}; extern_class!( #[derive(Debug, PartialEq, Eq, Hash)] pub(crate) struct NSMenuItem; unsafe impl C...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/appkit/mod.rs
Rust
//! Safe bindings for the AppKit framework. //! //! These are split out from the rest of `winit` to make safety easier to review. //! In the future, these should probably live in another crate like `cacao`. //! //! TODO: Main thread safety. // Objective-C methods have different conventions, and it's much easier to // u...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/appkit/pasteboard.rs
Rust
use objc2::foundation::{NSObject, NSString}; use objc2::rc::{Id, Shared}; use objc2::{extern_class, extern_methods, msg_send_id, ClassType}; extern_class!( #[derive(Debug, PartialEq, Eq, Hash)] pub(crate) struct NSPasteboard; unsafe impl ClassType for NSPasteboard { type Super = NSObject; } );...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/appkit/responder.rs
Rust
use objc2::foundation::{NSArray, NSObject}; use objc2::rc::Shared; use objc2::{extern_class, extern_methods, ClassType}; use super::NSEvent; extern_class!( #[derive(Debug, PartialEq, Eq, Hash)] pub(crate) struct NSResponder; unsafe impl ClassType for NSResponder { type Super = NSObject; } ); ...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/appkit/screen.rs
Rust
use objc2::foundation::{CGFloat, NSArray, NSDictionary, NSNumber, NSObject, NSRect, NSString}; use objc2::rc::{Id, Shared}; use objc2::runtime::Object; use objc2::{extern_class, extern_methods, msg_send_id, ns_string, ClassType}; extern_class!( #[derive(Debug, PartialEq, Eq, Hash)] pub(crate) struct NSScreen; ...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/appkit/text_input_context.rs
Rust
use objc2::foundation::{NSObject, NSString}; use objc2::rc::{Id, Shared}; use objc2::{extern_class, extern_methods, msg_send_id, ClassType}; type NSTextInputSourceIdentifier = NSString; extern_class!( /// Main-Thread-Only! #[derive(Debug, PartialEq, Eq, Hash)] pub(crate) struct NSTextInputContext; un...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/appkit/version.rs
Rust
#[repr(transparent)] #[derive(PartialEq, PartialOrd, Debug, Clone, Copy)] pub struct NSAppKitVersion(f64); #[allow(dead_code)] #[allow(non_upper_case_globals)] impl NSAppKitVersion { pub fn current() -> Self { extern "C" { static NSAppKitVersionNumber: NSAppKitVersion; } unsafe...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/appkit/view.rs
Rust
use std::ffi::c_void; use std::num::NonZeroIsize; use std::ptr; use objc2::foundation::{NSObject, NSPoint, NSRect}; use objc2::rc::{Id, Shared}; use objc2::runtime::Object; use objc2::{extern_class, extern_methods, msg_send_id, ClassType}; use super::{NSCursor, NSResponder, NSTextInputContext, NSWindow}; extern_clas...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/appkit/window.rs
Rust
use objc2::encode::{Encode, Encoding}; use objc2::foundation::{ CGFloat, NSArray, NSInteger, NSObject, NSPoint, NSRect, NSSize, NSString, NSUInteger, }; use objc2::rc::{Id, Shared}; use objc2::runtime::Object; use objc2::{extern_class, extern_methods, msg_send_id, ClassType}; use super::{NSButton, NSColor, NSEvent...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/event.rs
Rust
use std::os::raw::c_ushort; use objc2::rc::{Id, Shared}; use super::appkit::{NSEvent, NSEventModifierFlags}; use super::window::WinitWindow; use crate::{ dpi::LogicalSize, event::{ElementState, Event, KeyboardInput, ModifiersState, VirtualKeyCode, WindowEvent}, platform_impl::platform::{util::Never, DEVIC...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/event_loop.rs
Rust
use std::{ any::Any, cell::{Cell, RefCell}, collections::VecDeque, marker::PhantomData, mem, os::raw::c_void, panic::{catch_unwind, resume_unwind, RefUnwindSafe, UnwindSafe}, process, ptr, rc::{Rc, Weak}, sync::mpsc, }; use core_foundation::base::{CFIndex, CFRelease}; use core_f...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/ffi.rs
Rust
// TODO: Upstream these #![allow(dead_code, non_snake_case, non_upper_case_globals)] use std::ffi::c_void; use core_foundation::{ array::CFArrayRef, dictionary::CFDictionaryRef, string::CFStringRef, uuid::CFUUIDRef, }; use core_graphics::{ base::CGError, display::{CGDirectDisplayID, CGDisplayConfigRef}, ...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/menu.rs
Rust
use objc2::foundation::{NSProcessInfo, NSString}; use objc2::rc::{Id, Shared}; use objc2::runtime::Sel; use objc2::{ns_string, sel}; use super::appkit::{NSApp, NSEventModifierFlags, NSMenu, NSMenuItem}; struct KeyEquivalent<'a> { key: &'a NSString, masks: Option<NSEventModifierFlags>, } pub fn initialize() {...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/mod.rs
Rust
#![deny(unsafe_op_in_unsafe_fn)] #[macro_use] mod util; mod app; mod app_delegate; mod app_state; mod appkit; mod event; mod event_loop; mod ffi; mod menu; mod monitor; mod observer; mod view; mod window; mod window_delegate; use std::{fmt, ops::Deref}; use self::window::WinitWindow; use self::window_delegate::Wini...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/monitor.rs
Rust
#![allow(clippy::unnecessary_cast)] use std::{collections::VecDeque, fmt}; use core_foundation::{ array::{CFArrayGetCount, CFArrayGetValueAtIndex}, base::{CFRelease, TCFType}, string::CFString, }; use core_graphics::display::{CGDirectDisplayID, CGDisplay, CGDisplayBounds}; use objc2::rc::{Id, Shared}; us...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/observer.rs
Rust
use std::{ self, ffi::c_void, panic::{AssertUnwindSafe, UnwindSafe}, ptr, rc::Weak, time::Instant, }; use crate::platform_impl::platform::{ app_state::AppState, event_loop::{stop_app_on_panic, PanicInfo}, ffi, }; use core_foundation::base::{CFIndex, CFOptionFlags, CFRelease}; use co...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/util/async.rs
Rust
use std::ops::Deref; use dispatch::Queue; use objc2::foundation::{is_main_thread, CGFloat, NSPoint, NSSize, NSString}; use objc2::rc::{autoreleasepool, Id}; use crate::{ dpi::{LogicalPosition, LogicalSize}, platform_impl::platform::{ appkit::{NSScreen, NSWindow, NSWindowLevel, NSWindowStyleMask}, ...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/util/mod.rs
Rust
#![allow(clippy::unnecessary_cast)] mod r#async; pub(crate) use self::r#async::*; use core_graphics::display::CGDisplay; use objc2::foundation::{CGFloat, NSNotFound, NSPoint, NSRange, NSRect, NSUInteger}; use crate::dpi::LogicalPosition; // Replace with `!` once stable #[derive(Debug)] pub enum Never {} pub const...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/view.rs
Rust
#![allow(clippy::unnecessary_cast)] use std::{boxed::Box, os::raw::*, ptr, str, sync::Mutex}; use objc2::declare::{Ivar, IvarDrop}; use objc2::foundation::{ NSArray, NSAttributedString, NSAttributedStringKey, NSCopying, NSMutableAttributedString, NSObject, NSPoint, NSRange, NSRect, NSSize, NSString, NSUIntege...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/window.rs
Rust
#![allow(clippy::unnecessary_cast)] use std::{ collections::VecDeque, f64, ops, os::raw::c_void, sync::{ atomic::{AtomicBool, Ordering}, Mutex, MutexGuard, }, }; use raw_window_handle::{ AppKitDisplayHandle, AppKitWindowHandle, RawDisplayHandle, RawWindowHandle, }; use crate::...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/macos/window_delegate.rs
Rust
#![allow(clippy::unnecessary_cast)] use std::ptr; use objc2::declare::{Ivar, IvarDrop}; use objc2::foundation::{NSArray, NSObject, NSSize, NSString}; use objc2::rc::{autoreleasepool, Id, Shared}; use objc2::runtime::Object; use objc2::{class, declare_class, msg_send, msg_send_id, sel, ClassType}; use super::appkit::...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/mod.rs
Rust
use crate::monitor::{MonitorHandle as RootMonitorHandle, VideoMode as RootVideoMode}; use crate::window::Fullscreen as RootFullscreen; #[cfg(windows_platform)] #[path = "windows/mod.rs"] mod platform; #[cfg(any(x11_platform, wayland_platform))] #[path = "linux/mod.rs"] mod platform; #[cfg(macos_platform)] #[path = "ma...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/orbital/event_loop.rs
Rust
use std::{ collections::VecDeque, mem, slice, sync::{mpsc, Arc, Mutex}, time::Instant, }; use orbclient::{ ButtonEvent, EventOption, FocusEvent, HoverEvent, KeyEvent, MouseEvent, MoveEvent, QuitEvent, ResizeEvent, ScrollEvent, TextInputEvent, }; use raw_window_handle::{OrbitalDisplayHandle, Raw...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/orbital/mod.rs
Rust
#![cfg(target_os = "redox")] use std::str; use crate::dpi::{PhysicalPosition, PhysicalSize}; pub use self::event_loop::{EventLoop, EventLoopProxy, EventLoopWindowTarget}; mod event_loop; pub use self::window::Window; mod window; struct RedoxSocket { fd: usize, } impl RedoxSocket { fn event() -> syscall::R...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/orbital/window.rs
Rust
use std::{ collections::VecDeque, sync::{Arc, Mutex}, }; use raw_window_handle::{ OrbitalDisplayHandle, OrbitalWindowHandle, RawDisplayHandle, RawWindowHandle, }; use crate::{ dpi::{PhysicalPosition, PhysicalSize, Position, Size}, error, platform_impl::Fullscreen, window, window::ImePu...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/web/device.rs
Rust
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct DeviceId(pub i32); impl DeviceId { pub const unsafe fn dummy() -> Self { Self(0) } }
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/web/error.rs
Rust
use std::fmt; #[derive(Debug)] pub struct OsError(pub String); impl fmt::Display for OsError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.0) } }
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/web/event_loop/mod.rs
Rust
mod proxy; mod runner; mod state; mod window_target; pub use self::proxy::EventLoopProxy; pub use self::window_target::EventLoopWindowTarget; use super::{backend, device, window}; use crate::event::Event; use crate::event_loop::{ControlFlow, EventLoopWindowTarget as RootEventLoopWindowTarget}; use std::marker::Phant...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/web/event_loop/proxy.rs
Rust
use super::runner; use crate::event::Event; use crate::event_loop::EventLoopClosed; pub struct EventLoopProxy<T: 'static> { runner: runner::Shared<T>, } impl<T: 'static> EventLoopProxy<T> { pub fn new(runner: runner::Shared<T>) -> Self { Self { runner } } pub fn send_event(&self, event: T) ->...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/web/event_loop/runner.rs
Rust
use super::{super::ScaleChangeArgs, backend, state::State}; use crate::event::{Event, StartCause}; use crate::event_loop::ControlFlow; use crate::window::WindowId; use instant::{Duration, Instant}; use std::{ cell::RefCell, clone::Clone, collections::{HashSet, VecDeque}, iter, ops::Deref, rc::{...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/web/event_loop/state.rs
Rust
use super::backend; use crate::event_loop::ControlFlow; use instant::Instant; #[derive(Debug)] pub enum State { Init, WaitUntil { timeout: backend::Timeout, start: Instant, end: Instant, }, Wait { start: Instant, }, Poll { request: backend::AnimationFram...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/web/event_loop/window_target.rs
Rust
use std::cell::RefCell; use std::clone::Clone; use std::collections::{vec_deque::IntoIter as VecDequeIter, VecDeque}; use std::rc::Rc; use raw_window_handle::{RawDisplayHandle, WebDisplayHandle}; use super::{ super::monitor::MonitorHandle, backend, device::DeviceId, proxy::EventLoopProxy, runner, window::Wind...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/web/mod.rs
Rust
// Brief introduction to the internals of the web backend: // The web backend used to support both wasm-bindgen and stdweb as methods of binding to the // environment. Because they are both supporting the same underlying APIs, the actual web bindings // are cordoned off into backend abstractions, which present the thin...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/web/monitor.rs
Rust
use crate::dpi::{PhysicalPosition, PhysicalSize}; #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct MonitorHandle; impl MonitorHandle { pub fn scale_factor(&self) -> f64 { 1.0 } pub fn position(&self) -> PhysicalPosition<i32> { PhysicalPosition { x: 0, y: 0 } ...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/web/web_sys/canvas.rs
Rust
use super::event; use super::event_handle::EventListenerHandle; use super::media_query_handle::MediaQueryListHandle; use crate::dpi::{LogicalPosition, PhysicalPosition, PhysicalSize}; use crate::error::OsError as RootOE; use crate::event::{ Force, ModifiersState, MouseButton, MouseScrollDelta, ScanCode, VirtualKeyC...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/web/web_sys/canvas/mouse_handler.rs
Rust
use super::event; use super::EventListenerHandle; use crate::dpi::PhysicalPosition; use crate::event::{ModifiersState, MouseButton}; use std::cell::RefCell; use std::rc::Rc; use web_sys::{EventTarget, MouseEvent}; type MouseLeaveHandler = Rc<RefCell<Option<Box<dyn FnMut(i32)>>>>; #[allow(dead_code)] pub(super) stru...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/web/web_sys/canvas/pointer_handler.rs
Rust
use super::event; use super::EventListenerHandle; use crate::dpi::PhysicalPosition; use crate::event::Force; use crate::event::{ModifiersState, MouseButton}; use web_sys::PointerEvent; #[allow(dead_code)] pub(super) struct PointerHandler { on_cursor_leave: Option<EventListenerHandle<dyn FnMut(PointerEvent)>>, ...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/web/web_sys/event.rs
Rust
use crate::dpi::LogicalPosition; use crate::event::{ModifiersState, MouseButton, MouseScrollDelta, ScanCode, VirtualKeyCode}; use std::convert::TryInto; use web_sys::{HtmlCanvasElement, KeyboardEvent, MouseEvent, PointerEvent, WheelEvent}; pub fn mouse_button(event: &MouseEvent) -> MouseButton { match event.butto...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/web/web_sys/event_handle.rs
Rust
use wasm_bindgen::{prelude::Closure, JsCast}; use web_sys::{AddEventListenerOptions, EventListenerOptions, EventTarget}; pub(super) struct EventListenerHandle<T: ?Sized> { target: EventTarget, event_type: &'static str, listener: Closure<T>, options: EventListenerOptions, } impl<T: ?Sized> EventListene...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/web/web_sys/media_query_handle.rs
Rust
use wasm_bindgen::{prelude::Closure, JsCast}; use web_sys::{MediaQueryList, MediaQueryListEvent}; pub(super) struct MediaQueryListHandle { mql: MediaQueryList, listener: Option<Closure<dyn FnMut(MediaQueryListEvent)>>, } impl MediaQueryListHandle { pub fn new( media_query: &str, listener: ...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/web/web_sys/mod.rs
Rust
mod canvas; mod event; mod event_handle; mod media_query_handle; mod scaling; mod timeout; pub use self::canvas::Canvas; pub use self::scaling::ScaleChangeDetector; pub use self::timeout::{AnimationFrameRequest, Timeout}; use crate::dpi::{LogicalSize, Size}; use crate::platform::web::WindowExtWebSys; use crate::windo...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/web/web_sys/scaling.rs
Rust
use super::super::ScaleChangeArgs; use super::media_query_handle::MediaQueryListHandle; use std::{cell::RefCell, rc::Rc}; use wasm_bindgen::prelude::Closure; use web_sys::MediaQueryListEvent; pub struct ScaleChangeDetector(Rc<RefCell<ScaleChangeDetectorInternal>>); impl ScaleChangeDetector { pub(crate) fn new<F>...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/web/web_sys/timeout.rs
Rust
use std::cell::Cell; use std::rc::Rc; use std::time::Duration; use wasm_bindgen::closure::Closure; use wasm_bindgen::JsCast; #[derive(Debug)] pub struct Timeout { handle: i32, _closure: Closure<dyn FnMut()>, } impl Timeout { pub fn new<F>(f: F, duration: Duration) -> Timeout where F: 'static +...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/web/window.rs
Rust
use crate::dpi::{LogicalSize, PhysicalPosition, PhysicalSize, Position, Size}; use crate::error::{ExternalError, NotSupportedError, OsError as RootOE}; use crate::event; use crate::icon::Icon; use crate::window::{ CursorGrabMode, CursorIcon, ImePurpose, ResizeDirection, Theme, UserAttentionType, WindowAttribute...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/windows/dark_mode.rs
Rust
/// This is a simple implementation of support for Windows Dark Mode, /// which is inspired by the solution in https://github.com/ysc3839/win32-darkmode use std::{ffi::c_void, ptr}; use once_cell::sync::Lazy; use windows_sys::{ core::PCSTR, Win32::{ Foundation::{BOOL, HWND, NTSTATUS, S_OK}, Sys...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/windows/definitions.rs
Rust
#![allow(non_snake_case)] #![allow(non_upper_case_globals)] use std::ffi::c_void; use windows_sys::{ core::{IUnknown, GUID, HRESULT}, Win32::{ Foundation::{BOOL, HWND, POINTL}, System::Com::{ IAdviseSink, IDataObject, IEnumFORMATETC, IEnumSTATDATA, FORMATETC, STGMEDIUM, }, ...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/windows/dpi.rs
Rust
#![allow(non_snake_case, unused_unsafe)] use std::sync::Once; use windows_sys::Win32::{ Foundation::{HWND, S_OK}, Graphics::Gdi::{ GetDC, GetDeviceCaps, MonitorFromWindow, HMONITOR, LOGPIXELSX, MONITOR_DEFAULTTONEAREST, }, UI::{ HiDpi::{ DPI_AWARENESS_CONTEXT, DPI_AWARENESS...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/windows/drop_handler.rs
Rust
use std::{ ffi::{c_void, OsString}, os::windows::ffi::OsStringExt, path::PathBuf, ptr, sync::atomic::{AtomicUsize, Ordering}, }; use windows_sys::{ core::{IUnknown, GUID, HRESULT}, Win32::{ Foundation::{DV_E_FORMATETC, HWND, POINTL, S_OK}, System::{ Com::{IDataOb...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/windows/event.rs
Rust
use std::{ char, sync::atomic::{AtomicBool, AtomicIsize, Ordering}, }; use windows_sys::Win32::{ Foundation::{LPARAM, WPARAM}, UI::{ Input::KeyboardAndMouse::{ GetKeyState, GetKeyboardLayout, GetKeyboardState, MapVirtualKeyA, ToUnicodeEx, MAPVK_VK_TO_CHAR, MAPVK_VSC_TO_V...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/windows/event_loop.rs
Rust
#![allow(non_snake_case)] mod runner; use std::{ cell::Cell, collections::VecDeque, ffi::c_void, marker::PhantomData, mem, panic, ptr, rc::Rc, sync::{ atomic::{AtomicU32, Ordering}, mpsc::{self, Receiver, Sender}, Arc, Mutex, MutexGuard, }, thread, time:...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/windows/event_loop/runner.rs
Rust
use std::{ any::Any, cell::{Cell, RefCell}, collections::{HashSet, VecDeque}, mem, panic, ptr, rc::Rc, time::Instant, }; use windows_sys::Win32::{ Foundation::HWND, Graphics::Gdi::{RedrawWindow, RDW_INTERNALPAINT}, }; use crate::{ dpi::PhysicalSize, event::{Event, StartCause, W...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/windows/icon.rs
Rust
use std::{fmt, io, mem, path::Path, sync::Arc}; use windows_sys::{ core::PCWSTR, Win32::{ Foundation::HWND, UI::WindowsAndMessaging::{ CreateIcon, DestroyIcon, LoadImageW, SendMessageW, HICON, ICON_BIG, ICON_SMALL, IMAGE_ICON, LR_DEFAULTSIZE, LR_LOADFROMFILE, WM_SETICON,...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/windows/ime.rs
Rust
use std::{ ffi::{c_void, OsString}, mem::zeroed, os::windows::prelude::OsStringExt, ptr::null_mut, }; use windows_sys::Win32::{ Foundation::POINT, Globalization::HIMC, UI::{ Input::Ime::{ ImmAssociateContextEx, ImmGetCompositionStringW, ImmGetContext, ImmReleaseContext, ...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/windows/mod.rs
Rust
#![cfg(windows_platform)] use windows_sys::Win32::{ Foundation::{HANDLE, HWND}, UI::WindowsAndMessaging::{HMENU, WINDOW_LONG_PTR_INDEX}, }; pub(crate) use self::{ event_loop::{ EventLoop, EventLoopProxy, EventLoopWindowTarget, PlatformSpecificEventLoopAttributes, }, icon::WinIcon, moni...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/windows/monitor.rs
Rust
use std::{ collections::{BTreeSet, VecDeque}, hash::Hash, io, mem, ptr, }; use windows_sys::Win32::{ Foundation::{BOOL, HWND, LPARAM, POINT, RECT}, Graphics::Gdi::{ EnumDisplayMonitors, EnumDisplaySettingsExW, GetMonitorInfoW, MonitorFromPoint, MonitorFromWindow, DEVMODEW, DM_BITSPE...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei
src/platform_impl/windows/raw_input.rs
Rust
use std::{ mem::{self, size_of}, ptr, }; use windows_sys::Win32::{ Devices::HumanInterfaceDevice::{ HID_USAGE_GENERIC_KEYBOARD, HID_USAGE_GENERIC_MOUSE, HID_USAGE_PAGE_GENERIC, }, Foundation::{HANDLE, HWND}, UI::{ Input::{ GetRawInputData, GetRawInputDeviceInfoW, Get...
wusyong/winit-gtk
3
Rust
wusyong
Wu Yuwei