Commit Graph

136 Commits

Author SHA1 Message Date
Kristian Høgsberg
0b36d9780f terminal: Include config.h instead of defining _XOPEN_SOURCE 2013-08-21 22:13:17 -07:00
Peng Wu
cfcc111070 Fixes CJK wide character display
By jumping two columns when wide character prints,
and draw wide background under wide character.
2013-08-19 15:37:19 -07:00
Kristian Høgsberg
3e125830a5 terminal: Make utf-8 state machine assemble unicode code point value 2013-08-13 17:23:54 -07:00
Brian Lovin
1bf14815ef terminal.c: Check if fdopen() fails
If fdopen() fails we just close the fd and return, failing
the copy-and-paste.

Signed-off-by: Brian Lovin <brian.j.lovin@intel.com>
2013-08-08 16:25:13 -07:00
Peter Hutterer
f3d62276d2 malloc + memset -> zalloc
And for clients using the xmalloc helper, use xzalloc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-08-08 13:46:13 -07:00
Brian Lovin
bc91926e0c clients: use xmalloc in more places
For the clients continue to use xmalloc() to simplify OOM-handling.

Signed-off-by: Brian Lovin <brian.j.lovin@intel.com>
2013-08-07 16:27:33 -07:00
Peng Wu
f291f20553 Use the average width of ASCII glyphs for cell width
As some CJK fonts are dual-width, calculate the average width of ASCII
glyphs and use that instead of the max_x_advance of the font.  This is
what VTE does too.

https://bugs.freedesktop.org/show_bug.cgi?id=63796
2013-07-08 17:57:59 -04:00
Alexander Larsson
de79dd0485 terminal: Handle output transform
We pick the highest scale of any output the terminal is on, and the
transform from the last one it entered.
2013-05-22 16:18:57 -04:00
Ossama Othman
a50e6e4c50 config-parser: Honor XDG_CONFIG_DIRS
This set of changes adds support for searching for a given config file
in the directories listed in $XDG_CONFIG_DIRS if it wasn't found in
$XDG_CONFIG_HOME or ~/.config.  This allows packages to install custom
config files in /etc/xdg/weston, for example, thus allowing them to
avoid dealing with home directories.

To avoid a TOCTOU race the config file is actually open()ed during the
search.  Its file descriptor is returned and stored in the compositor
for later use when performing subsequent config file parses.

Signed-off-by: Ossama Othman <ossama.othman@intel.com>
2013-05-14 14:36:37 -04:00
Kristian Høgsberg
4172f668e7 Pass argc pointer to parse_options()
This lets us keep argc up to date as the backend picks out arguments
from the argv array.
2013-02-20 15:27:49 -05:00
Dima Ryazanov
d20fd4db60 terminal: Handle the window close event
There may be multiple windows open, so destroy the terminal instead of exiting.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
2013-01-28 12:26:54 -05:00
Dima Ryazanov
a85292e73c Fix a crash when opening two terminal windows and closing the first one.
To reproduce, launch the terminal, open a second window using Ctrl-Shift-N,
go back to the first window, and press Ctrl-D. The terminal's master FD gets
events even after being closed, causing terminal_destroy to be called twice
on the same object.

To fix this, I'm adding a function to stop watching an FD.
2012-11-30 14:11:41 -05:00
Daniel Stone
a84687174c Terminal: Handle keypad symbols
XKB provides keypad symbols in a separate namespace.  We don't care
about the distinction, so map them to normal symbols before starting
processing.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-11-08 14:08:53 -05:00
Kristian Høgsberg
b36f7ef99e terminal: Don't snap resize if we're maximized
We allow fullscreen to fill the requested size, do the same for maximize.
2012-10-10 11:41:21 -04:00
Kristian Høgsberg
b7ed4cbbc7 terminal: Use window_get_fullscreen() instead of tracking that state manually 2012-10-10 11:37:46 -04:00
Philipp Brüschweiler
fdb4b02501 terminal: support entering non-ascii characters
Unless the alt modifier is active and the MODE_ALT_SENDS_ESC mode is not
set, any value over 127 is converted to a UTF8 sequence.

Part of https://bugs.freedesktop.org/show_bug.cgi?id=53648 should be
fixed with this.

Part of https://bugs.freedesktop.org/show_bug.cgi?id=52419 is fixed, but
interestingly it depends on the activated keymap (i.e. it works with
dvorak, but not with ch).
2012-08-29 14:47:07 -04:00
Kristian Høgsberg
86adef9d54 window.c: Handle multiple keyboard foci
Keep a count of number of wl_keyboard focus we have instead of
tracking the more recent wl_keyboard.
2012-08-13 22:28:10 -04:00
Andre Heider
552d12b10e terminal: Don't crash on non-ascii chars
isalpha() and isdigit() don't like huge values.
Noticed with ascii-art in the shell prompt.
2012-08-03 12:54:06 -04:00
Kristian Høgsberg
2a1aa4efce terminal: Don't output @ for ASCII NUL
Fixes visual bell in screen.
2012-08-03 09:37:05 -04:00
Kristian Høgsberg
67ace20f8e window.c: Add fullscreen handler to keep fullscreen state consistent 2012-07-23 21:56:31 -04:00
Kristian Høgsberg
d3a1965a3d clients: Implement minimum size for toy toolkit clients
We default to setting the minimum size to the initial size.  To set a
different minimum size than the initial size, set the minimum size first
then then initial size.  Good enough for a toy toolkit.

https://bugs.freedesktop.org/show_bug.cgi?id=50263
2012-07-20 11:33:02 -04:00
Kristian Høgsberg
0fe782bdb5 terminal: Extend selection to end of line when selecting past last char 2012-07-01 23:59:08 -04:00
Kristian Høgsberg
0dee6475bd terminal: Insert newlines when copying multiple lines 2012-07-01 21:25:41 -04:00
Kristian Høgsberg
8268d41410 terminal: Handle selection for pointer positions outside widget correctly
That is, don't crash and select entire first/last line when the pointer
is above or below widget.
2012-06-29 12:28:41 -04:00
Kristian Høgsberg
29784402e1 terminal: Add a terminal enter handler for setting I-beam cursor
Now that the mod+click shortcuts change the cursor, this was suddenly obvious.
2012-06-28 14:27:02 -04:00
Kristian Høgsberg
18e928dfb8 terminal: Scroll selection with terminal contents 2012-06-27 19:29:41 -04:00
Kristian Høgsberg
38912df847 terminal: Make font size configurable 2012-06-27 17:52:23 -04:00
Kristian Høgsberg
333db0a17e terminal: Implement word and line based selection
Double-click to select by word, triple click to select by line.
2012-06-27 17:43:10 -04:00
Kristian Høgsberg
129decbdf7 terminal: Tab should not output spaces, just move cursor
Emacs uses tab and backspace to move the cursor as well as the regular
cursor movement escape codes.  When it's less bytes than the escape code,
emacs will use a tab or tab + backspace to move the cursor forward.  The
effect is that as you're  moving around in the buffer, emacs will
(seemingly) randomly insert spaces and overwrite what's in the terminal.
Making tab just move the cursor as it should fixes this.
2012-06-26 13:22:03 -04:00
Kristian Høgsberg
22fbcf7183 terminal: Ignore more modifier keys
Don't want these to leak into the terminal.
2012-06-22 12:18:56 -04:00
Kristian Høgsberg
b24ab806bf terminal: Only hide cursor for keypresses that generate data for the process 2012-06-22 12:18:20 -04:00
Kristian Høgsberg
88fd40815a terminal: Only hide cursor on first key-press in a repeat sequence
Otherwise moving the pointer while holding a key down will flicker.
2012-06-21 15:55:03 -04:00
Kristian Høgsberg
ae9e073ac5 terminal: Support both Alt and Control modifiers for regular keys 2012-06-21 12:32:23 -04:00
Kristian Høgsberg
b7f94bff3d terminal: Handle Alt-Backspace 2012-06-21 12:32:23 -04:00
Kristian Høgsberg
63b298f3c7 terminal: Set blank cursor on keyboard press
This way we can better see the contents of the terminal.  Show cursor again
on pointer motion.
2012-06-20 23:04:58 -04:00
Kristian Høgsberg
b21fb9f61e terminal: Add Ctrl-Shift-N keyboard binding to open new window 2012-06-20 22:44:03 -04:00
Kristian Høgsberg
de845cfcc0 terminal: Default terminal type to xterm
We add an option to configure the terminal type so it's still possible to
get xterm-256color.
2012-06-20 22:14:35 -04:00
Kristian Høgsberg
71a4cf4374 terminal: Send ASCII DEL on for backspace 2012-06-20 17:57:56 -04:00
Kristian Høgsberg
a1627927c7 window: Compute initial window size correctly
We didn't take decoration size into account before.
2012-06-20 17:30:03 -04:00
Kristian Høgsberg
e828e904b5 terminal: Track down remaining unhandled xterm-256color escape codes 2012-06-20 16:59:17 -04:00
Kristian Høgsberg
cca3c2f9da terminal: Fix tab expansion 2012-06-20 15:56:13 -04:00
Kristian Høgsberg
82cd36bfff terminal: Make terminal font configurable from command line and weston.ini 2012-06-20 15:29:07 -04:00
Alexander Preisinger
e2b88c093a Add minimum size for terminal
At the moment the terminal can a negativ size and resizing it can create
some artifacts.
2012-06-18 15:14:29 -04:00
Kristian Høgsberg
fee91be586 terminal: Use serial, not timestamp for setting the selection 2012-06-02 21:21:41 -04:00
Daniel Stone
c9785eacca Use enum wl_keyboard_key_state instead of integer
Instead of using a uint32_t for state everywhere (except on the wire,
where that's still the call signature), use the new
wl_keyboard_key_state enum, and explicit comparisons.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:43:03 -04:00
Daniel Stone
4dbadb1556 Use enum wl_pointer_button_state instead of integer
Instead of using a uint32_t for state everywhere (except on the wire,
where that's still the call signature), use the new
wl_pointer_button_state enum, and explicit comparisons.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:42:47 -04:00
Scott Moreau
7a1b32a198 Implement text cursor position protocol.
Here we create a new client/compositor interface in weston to allow
clients to report their x/y cursor position to the compositor. These
values are then used to center the zoom area on this point. This
is useful for everyone, especially people who are visually impaired.
2012-05-31 13:10:22 -04:00
David Herrmann
a6128d6183 terminal: add glyphs to character list
This adds the actual glyphs/utf-8 characters to the comments of CS_SPECIAL
(DEC special graphics set). They all work on my system with "Monospace" or
"Bitstream" font. But keep the mnemonics so if the UTF8 characters are not
displayed correctly, the comments are still readable.

I don't know if gcc actually reads data as UTF-8 or if C code actually
allows all UTF8 characters. However, unless it reads as "*/" in ASCII, it
shouldn't matter inside of comments.

Anyway, it compiles fine with gcc-4.7.0/amd64 here.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-29 09:56:27 -04:00
David Herrmann
516b9e1753 terminal: fix up horizontal scan-line characters
The DEC special graphics set defines entries 0x6f to 0x73 to be:
  Horizontal Scan Line 1
  Horizontal Scan Line 3
  Horizontal Scan Line 5
  Horizontal Scan Line 7
  Horizontal Scan Line 9
However, the first Unicode drafts included only Scan-Line 5. Since
Unicode-3.2 the other Scan-Lines were added and are available in most
Unicode fonts now.

The codes are listed here:
  http://www.fileformat.info/info/unicode/block/miscellaneous_technical/images.htm?start=9089
Or more precisely:
  Scan 1: http://www.fileformat.info/info/unicode/char/23ba/index.htm
  Scan 3: http://www.fileformat.info/info/unicode/char/23bb/index.htm
  Scan 7: http://www.fileformat.info/info/unicode/char/23bc/index.htm
  Scan 9: http://www.fileformat.info/info/unicode/char/23bd/index.htm
Scan 5 is kept the same as before as it wasn't added separately and was
already correct before.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-29 09:54:50 -04:00
Ander Conselvan de Oliveira
dc8c8fce72 window: rename enum pointer_type to cursor_type
This avoids confusion with the pointer devices (struct wl_pointer).
2012-05-25 23:28:54 -04:00