Commit Graph

64 Commits

Author SHA1 Message Date
mihaicmn c78afab5f8 migrate i3-input to draw_util (#2645) 2017-01-21 07:30:31 -08:00
Ingo Bürk d58dbc3a77 Only react on the last Expose event in a series of events. (#2636)
Thanks to @psychon for pointing this out during the review of PR #2624.
This commit extends this change to all other occurences of Expose events
within i3.
2017-01-13 09:34:58 -08:00
Ingo Bürk 6b9b12c303 Do not set input focus in i3-input. (#2598)
This commit removes all traces of setting and reverting the input focus
in i3-input. We don't need to do this because grabbing the keyboard is
sufficient to have the attention we need.

Changing the input focus and reverting it can cause situations where i3
executes the IPC command before processing the FocusIn events. This leads
to i3's input focus change to be rejected due to the timing, leading to
an inconsistent focus state.

fixes #2597
2016-12-02 19:05:43 +01:00
Michael Stapelberg f354f53435 Ensure all *.[ch] files include config.h
Including config.h is necessary to get e.g. the _GNU_SOURCE define and
any other definitions that autoconf declares. Hence, config.h needs to
be included as the first header in each file.

This is done either via:
1. Including "common.h" (i3bar)
2. Including "libi3.h"
3. Including "all.h" (i3)
4. Including <config.h> directly

Also remove now-unused I3__FILE__, add copyright/license statement
where missing and switch include/all.h to #pragma once.
2016-10-23 21:09:24 +02:00
Ingo Bürk 152318bccf Remove dead code guarded with "#if 0 … #endif" (#2338)
This code has been neutralized for many years now and served no purpose
other than cluttering up the code. We obviously don't need it and it's
out of date anyway.

If there's ever any reason to restore (parts of) it, we have git for
that. But we don't need to keep commented out code around.
2016-05-05 14:18:04 +02:00
Ingo Bürk 4365f46d1b i3-input: Proper position in non-standard cases. (#2313)
This commit fixes two issues:
* We detect the EWMH support window from the root window. If this window
  currently has the input focus, we ignore this. We do this because this
  window is not a window the user is aware of and positioning relative to
  it makes no sense.
* We also detect whether the current input focus is in an i3-frame window.
  This can happen, e.g., when selecting a parent (split) container. Since
  frame windows are direct children of the root window, we must not
  translate its coordinates or we get weird results and i3-input ends up
  off-screen (see #2312). For all other windows, including those without
  any WM_CLASS, we proceed as before.

fixes #2312
2016-04-30 22:04:57 +01:00
Eric Engeström 66d9c983e4 Fix spelling mistakes 2016-04-04 09:33:59 +02:00
Michael Stapelberg fbfbdb8e12 travis: check spelling of binaries and manpages, use docker
We now build a docker base container based on debian sid (where the very
latest packages are available). That base container is updated once a
month, or whenever travis-build.Dockerfile or debian/control change, but
re-used for subsequent travis runs. While the initial build might take
up to 15 minutes, subsequent builds typically run in a minute or two.

All the different steps that we run on travis are now factored into
separate scripts in the travis/ directory.

Switching to docker should also help with issue #2174.
2016-02-06 10:36:43 +01:00
Alex Auvolat c6a4e4519f Correct color management for pango fonts
Corrects the cases where the colorpixel is not 0xRRGGBB : we have to
use the full color_t struct to describe font colors, as Pango expects
RGB values and not an XCB colorpixel value.
2015-12-29 14:26:21 +01:00
Ingo Bürk 1c4100ce5d Use 32-bit visuals for i3bar when possible and allow RGBA colors.
This patch creates all necessary windows for i3bar with 32-bit visuals if available.
It also introduces the possibility to define RGBA colors (next to RGB colors), which
allows the user to set the opacity of any color. This requires running a compositor.

With this patch we also start supporting _NET_SYSTEM_TRAY_VISUAL, which is necessary
for the tray icons so they create the tray window with the correct depth and visual.
2015-10-06 23:01:57 +02:00
shdown c85d16faa4 Use safe wrappers wherever possible 2015-08-03 12:50:50 +03:00
Ingo Bürk 94a09b3cac Added missing newlines in log statements. 2015-06-30 20:48:35 +02:00
Deiz 884214f14f Update copyright notices and get rid of ranges
The script used to make these changes can be found at:

   https://gist.github.com/Deiz/32322020f76d23e2bf8f
2015-04-20 17:50:21 -04:00
Ingo Bürk 947c67a627 Position i3-input at window with input focus
This positions the i3-input window at the window holding the input focus' position, plus a small offset.

fixes #1058
2015-04-02 08:37:09 +02:00
Michael Stapelberg ad31b13cb6 update default fonts for i3-{input,config-wizard,nagbar}
We’ve done this a while ago in i3.config itself, but the tools in
question aren’t hooked up to that setting, so we need to do it here as
well.
2015-03-26 10:03:30 +01:00
Michael Stapelberg 7d49f55c55 make i3-input work properly on hi-dpi displays 2015-03-26 10:03:14 +01:00
Michael Stapelberg 091f1db39a run clang-format (3.5.0)
Not quite sure why there are so many differences. Perhaps we’ve gotten
out of the habit of running clang-format after every change.

I guess it’d be best to have a travis hook that runs clang-format for us
and reports any problems on pull requests.
2015-03-01 17:16:03 +01:00
Michael Stapelberg 9200094203 format **/*.c with clang-format-3.5
This has multiple effects:

1) The i3 codebase is now consistently formatted. clang-format uncovered
   plenty of places where inconsistent code made it into our code base.

2) When writing code, you don’t need to think or worry about our coding
   style. Write it in yours, then run clang-format-3.5

3) When submitting patches, we don’t need to argue about coding style.

The basic idea is that we don’t want to care about _how_ we write the
code, but _what_ it does :). The coding style that we use is defined in
the .clang-format config file and is based on the google style, but
adapted in such a way that the number of modifications to the i3 code
base is minimal.
2014-06-15 19:07:02 +02:00
Michael Stapelberg e2f47ef466 i3-input: fix (irrelevant) memory leak
Given that the code was exit(0)ing directly after using that memory,
it’s not like this has any effect. However, less false positives on the
clang-analyze report pages is a good thing.
2014-05-15 23:50:09 +02:00
Michael Stapelberg 0883dfbe14 only LOG() the DPI when it changes, DLOG() it otherwise (Thanks lkraav)
This avoids flooding stdout every time some text (e.g. a window
decoration) is drawn, yet leaves the message in place when it’s actually
relevant (upon DPI changes).

fixes #1115
2013-12-24 10:35:56 +01:00
Michael Stapelberg d3beff2339 make i3bar use libi3’s root_atom_contents()
This removes code duplication, which will be useful for a subsequent
commit.

Furthermore, we now don’t open X11 connections unnecessarily in some
corner cases.
2013-11-22 15:48:45 +01:00
Michael Stapelberg 28933f8de3 i3-input: set focus before sending the command (Thanks emias)
This avoids problems with sending 'focus left' or other commands which
manipulate focus.
2013-01-24 13:57:08 +01:00
Michael Stapelberg 5779f573e7 i3-input: restore input focus on exit() (Thanks f8l)
fixes #641
2012-12-19 18:22:03 +01:00
Oliver Kiddle f7d825062a remove superfluous ev.h include statements 2012-09-20 11:15:17 +02:00
Quentin Glidic a007283773 i3-input: Fix text drawing offset 2012-08-28 12:06:03 +02:00
Quentin Glidic af15087b99 i3-input: Do not use a non-loaded font
We must call load_font before any font-related calls like
predict_text_width
2012-08-28 10:58:18 +02:00
Michael Stapelberg 2896ae8057 logging: make libi3 use verboselog()/errorlog(), provide it in each caller
While this is a bit ugly, it makes the log messages end up where they
are supposed to: in the shmlog/stdout in case of i3 and on stdout in
case of utilities such as i3-input
2012-08-13 13:27:16 +02:00
Fernando Tarlá Cardoso Lemos 6ff3f7abad libi3: Implement Pango rendering 2012-08-13 11:39:30 +02:00
Quentin Glidic 210fc6dfed libi3: Rework predict_text_width
predict_text_width now takes an i3String as argument
2012-08-13 11:37:23 +02:00
Quentin Glidic 53365fa887 libi3: Rework draw_text
We now have two versions of draw_text
draw_text: Now takes an i3String
draw_text_ascii: Designed for static strings in plain ASCII
2012-08-13 11:37:21 +02:00
Quentin Glidic 284294e9c2 i3-input: Store and use xcb_char2b_t directly 2012-08-13 11:30:08 +02:00
Quentin Glidic d89cb04c98 i3-input: Port prompt to i3String 2012-08-13 11:30:08 +02:00
Michael Stapelberg 8a1c8115ca fix a few warnings/places where the clang static analyzer complains 2012-08-05 16:34:38 +02:00
Michael Stapelberg dee7c07ad2 shmlog: store meta information in the buffer itself, store path as X11 atom
This makes i3-dump-log completely independent of a running i3 instance.
2012-01-06 23:40:07 +00:00
Michael Stapelberg 561cf3719f little style fixes 2011-11-21 21:48:24 +00:00
Fernando Tarlá Cardoso Lemos 344c04af12 Implement set_font_colors.
This paves the way for other font rendering backends. Fonts and
colors shouldn't be specified manually from now on.
2011-11-21 20:52:32 +00:00
Fernando Tarlá Cardoso Lemos eafc7af606 Make all programs use draw_text. 2011-11-21 20:52:29 +00:00
Fernando Tarlá Cardoso Lemos fb11cc2d14 Consolidate all convert_* functions into libi3.
Some minor fixes along the way as well. Very minor stuff, unlikely
to ever be visible to the user.
2011-11-16 20:54:30 +00:00
Michael Stapelberg 726f2a1e5a normalize file headers across **/*.{h,c} 2011-10-25 21:19:38 +01:00
Michael Stapelberg f4469eee0b get rid of xcb.c in all i3-* tools
open_input_window was slightly different for each of them, so it made no sense
to generalize it (then we would end up with a thin and useless wrapper).
2011-10-23 23:20:57 +01:00
Michael Stapelberg a58018cf66 Add libi3/load_font, use it everywhere
…except for i3bar, which needs slightly more information about the font
2011-10-23 22:37:11 +01:00
Michael Stapelberg 05d097bb36 i3-input: fix handling of Mode_switch (makes special characters work again)
This seems to have only worked before in certain settings, where the modifiers
were configured in a way that it matched by chance…
2011-10-23 19:34:48 +01:00
Michael Stapelberg 7c04e23ab7 i3-input: Bugfix: font must be dynamically allocated, we FREE it later 2011-10-23 19:34:21 +01:00
Michael Stapelberg cb9bbcfccf Move get_colorpixel to libi3, use it everywhere else 2011-10-23 17:38:21 +01:00
Michael Stapelberg 0086bcb2b4 i3-input: eliminate xcb_change_gc_single usage with C99 2011-10-23 17:26:06 +01:00
Michael Stapelberg 4f57d49318 add libi3/ipc_connect, use it in i3-config-wizard, i3-input, i3bar 2011-10-23 17:18:14 +01:00
Michael Stapelberg 9d15a00ba8 introduce sasprintf() in libi3, use it everywhere 2011-10-23 13:16:56 +01:00
Michael Stapelberg d87b0f13a0 i3-input: use IPC functions from libi3 2011-10-23 13:15:20 +01:00
Michael Stapelberg 1737a78fcd i3-input: implement -F (format) option, deprecate -p (prefix)
This introduces the '-F format' parameter, which takes a format and replaces %s
in it with the user input. An example: The user should enter the target
workspace name. The appropriate i3-input invocation looks like this:

    i3-input -F 'workspace "%s"' -P 'Switch to workspace: '
2011-09-18 13:51:11 +01:00
Michael Stapelberg fddee471e8 i3-input: add missing \n in --help 2011-09-18 13:21:45 +01:00