aboutsummaryrefslogtreecommitdiff
path: root/src/window.rs
AgeCommit message (Collapse)Author
2018-03-04Remove all instances of unwrap() from configChristian Duerr
Unwrapping inside the config file parsing can lead to some issues that prevent us from falling back to a default configuration file. One instance of that issue was mentioned in #1135. Now all instances of `unwrap()` have been removed and replaced with proper error handling. This will make the config more robust and prevents live reload from silently breaking while alacritty is running. This also fixes a few currently existing clippy issues. Clippy added an additonal lint which complains about `MyStruct { field: field }`. These issues have been fixed, except for some false-positives and issues in external macros which will probably be fixed with future updates (rust-lang-nursery/bitflags#149)
2018-01-15Spawn alacritty window as invisibleChristian Duerr
This change initially spawns alacritty as in invisible window, this makes it possible for the pty to already access data like `window_id` without having to wait for the window manager to actually open the window. Even though `GlWindow::new` is blocking when `with_visibility(true)` is used, the `window.show` call is not blocking. So calling `GlWindow::new` and `with_visibility(false)`, then immediately calling `window.show` will create a window and make it visible instantly.
2017-12-24Change mouse cursor on terminal mode change (#865)Dustin
Some terminals have functionality around changing the type of mouse cursor dynamically (arrow and text) based on which mode(s) the VTE is in. For example, gnome-terminal changes the cursor from text (default) to an arrow when opening programs that track mouse events (e.g. vim, emacs, tmux, htop, etc.). The programs all allow using the mouse interactively under some circumstances (like executing `set mouse=a` in vim). The programs that use an interactive mouse set the terminal mode to different values. Though they're not entirely the same terminal mode across programs, an emulator like vte (the library gnome-terminal implements), changes the mouse cursor if the mouse mode is one of the following: - 1000: Mouse Click Tracking - 1001: Mouse Highlight Tracking - 1002: Mouse Cell Motion Tracking - 1003: Mouse All Motion Tracking - 1004: Mouse Focus Tracking See https://github.com/GNOME/vte/blob/6acfa59dfcceef65c1f7e3570db37ab245f049c4/src/vteseq.cc#L708 for more information. This commit adds functionality that changes the winit/glutin `MouseCursor` when a mouse-listening mode of 1000-1004 is set. It behaves similarly to when the window title changes.
2017-12-23Update glutin to v0.11chetgurevitch
2017-12-22Add new window section to configRobert Günzler
Move/rename borderless into window_config as decorations
2017-12-22Add 'borderless' optionRobert Günzler
Until winit gives us more capabilities in regard to window decorations this implements a simple switch that renders the window without any title bar or border
2017-11-20Revert "Wait to display window until initialization is complete (#907)"Joe Wilm
This reverts commit a931d691a21a851ca4653cbab3542c600b72ff36. Please see https://github.com/jwilm/alacritty/pull/907#issuecomment-345666727 for rationale w/ GIF. > now alacritty starts "in stages". First it paints some small > rectangle, and in a second in "boots" and fills up the available > space.
2017-11-19Wait to display window until initialization is complete (#907)Charles
2017-10-26set_urgent on mac throws a warning (#867)Ty Coghlan
On mac, compiling throws a warning due to `is_urgent` not being used within `set_urgent`. This can be changed just by using an underscore instead.
2017-10-22Change cursor from pointer to text (#778)Dustin
It seems that (as a rule) terminal emulators use the text mouse cursor rather than the pointer that is used now. This commit changes the cursor to using winit's built-in configuration function.
2017-10-21Set urgent WM flag on bell on X11 systems (#812)Barret Rennie
Sets the urgent WM flag when bell is emitted on X11 systems. Additionally, the flag is cleared on focus because not all WMs clear it automatically.
2017-10-06Revert "Update glutin & fix a few wayland issues (#815)"Joe Wilm
This reverts commit e17d38167e174a2cf664e430fe968ec6492e1f08. Was breaking builds for mac users.
2017-10-06Update glutin & fix a few wayland issues (#815)Victor Berger
This PR fixes a few wayland issues of alacritty (and updates glutin on the process because it is needed). Mainly two changes are done: 1. Add a drawing_ready() method on Window: see https://docs.rs/winit/0.8.2/winit/os/unix/trait.WindowExt.html#tymethod.is_ready for explanations. Hopefully glutin will be able to handle it itself in the future, but it currently does not. 2. resize window and OpenGL contextes. The way wayland forces winit to draw its own decorations and how surface size is defined by its content means that in practice: - winit's window.set_inner_size() defines the dimensions of the borders - glutins gl_window.resize() defines the dimensions of the content (and is a noop in other platforms) It is for now glutin's user responsibility to keep them in sync otherwise borders are drawn stupidly. This PR changes the resize methods of alacritty::Window to always update both. This fixed the borders issues for me, tested on weston.
2017-09-27Use clippy = "*", update, and fix some warnings (#796)Aaron Hill
Because there are so many clippy warnings in the current codebase, this commit removes '#![cfg_attr(feature = "clippy", deny(clippy))]', to make it easier to fix warnings incrementally.
2017-08-20Add background_opacity option to set terminal transparency (#331)Gabriel Martinez
The option is an Alpha struct that ensures that the contained float is between 0.0 and 1.0. Background colors are multiplied by the opacity to properly alpha blend them.
2017-08-11Fix warnings on macOSJoe Wilm
2017-07-28Don't panic when setting cursor visibility fails (#683)Tuomas Siipola
Currently setting cursor visibility always fails on Wayland. It shouldn't be a critical error on any platform.
2017-07-24add support for X input method (#691)Ted Yin
2017-07-20Update to latest Glutin/winit (#671)Joe Wilm
* Update to latest Glutin/winit This *finally* gets us off the fork of Glutin we've been on for so long and will unblock a number of other items. Functionality should be the same as before. The update forced our hand on a compiler update. It's no longer feasible to pin on an old version. From now on, we require latest stable.
2017-05-27Find and set $WINDOWID to X11 window ID (#586)ns
2017-05-06Add window padding optionTuomas Siipola
Padding can be configured by using the `padding` field in the config file, like so: padding: x: 2 y: 2 which would result in a 2px padding within each side of the window.
2017-05-01Support setting _NET_WM_PID in X11 environmentsJoe Wilm
Support is added for setting _NET_WM_PID automatically. This is to support scripting of the window environment. For example, this makes it possible to script opening a window with same CWD: 1. Retrieve the current window 2. (new) get PID of window 3. Check if it's Alacritty, find first child (presumably a shell), and get the child's cwd. 4. Spawn new instance of terminal with cwd. Unaddressed in this commit is how this will coexist on a Wayland system.
2017-02-22hide mouse cursor mac osAnders Rasmussen
2017-02-22Set cursor only when its visibility changesTuomas Siipola
2017-02-22Add hide cursor when typing optionTuomas Siipola
2017-01-11Add support for setting title from OSCJoe Wilm
Resolves #23 Resolves #144
2017-01-06Replace need for drop_types_in_const with lazy_staticManish Goregaokar
2017-01-06Added --title argument to set window titleRudis Muiznieks
2016-12-29Fix pty read sometimes not triggering drawJoe Wilm
There was a lot of complexity around the threadsafe `Flag` type and waking up the event loop. The idea was to prevent unnecessary calls to the glutin window's wakeup_event_loop() method which can be expensive. This complexity made it difficult to get synchronization between the pty reader and the render thread correct. Now, the `dirty` flag on the terminal is also used to prevent spurious wakeups. It is only changed when the mutex is held, so race conditions associated with that flag shouldn't happen.
2016-12-16Rustup and clippyJoe Wilm
All of the changes in this commit are due to clippy lints.
2016-12-11Display manages window, renderer, rasterizerJoe Wilm
This is part of an ongoing decoupling effort across the codebase and tidying effort in main.rs. Everything to do with showing the window with a grid of characters is now managed by the `Display` type. It owns the window, the font rasterizer, and the renderer. The only info needed from it are dimensions of characters and the window itself for sizing the terminal properly. Additionally, the I/O loop has access to wake it up when new data arrives.
2016-12-11Add display impl for Points<T>Joe Wilm
2016-12-11Cleaning up main; Added window moduleJoe Wilm
Adds a wrapper for the glutin::Window which provides strongly typed APIs and more convenient interfaces. Moves some gl calls into the opengl-based renderer. The point of most of the changes here is to clean up main().