Commit Graph

48 Commits (ea216f88d89a5af70f76d4a89921f6c645f5b6e3)

Author SHA1 Message Date
Albert Safin 371dc23101 Tiling resize drag: use threshold 2019-10-03 06:09:57 +00:00
Albert Safin 551ec20941 drag_pointer(): add use_treshold parameter 2019-10-03 06:09:57 +00:00
Albert Safin 2795c51d4b drag_pointer(): drop unused parameter `border` 2019-10-03 06:05:34 +00:00
aksel bbfa140c0f For resizing, convert pixel diff to percentage, based on parent.
Previously, it first calculated one of the containers' next percentage, and then subtracted the previous percentage to find the actual change.

Now it directly calculates the change, and subtracts and adds the change to the two affected containers.

Added util function con_rect_size_in_orientation.

Removed px_resize_to_percent; inlined, using con_rect_size_in_orientation.

Also, prematurely return when pixel diff is 0, as no action is necessary.

This is related to [this issue on i3-gaps](https://github.com/Airblader/i3/issues/247).
2018-11-08 23:15:23 +01:00
Orestis Floros 23c1c13d34
Ensure containers have a size of at least 1px after resize
Fixes #2226.
Fixes #2776.
Fixes #3241.
Related to #3194.
2018-09-06 04:56:31 +03:00
Orestis Floros 2ead7745d6
Make cmd_resize_tiling_direction work with pixels
Introduces resize_neighboring_cons in resize.c which is also used by
resize_graphical_handler.

Co-authored-by: Andrew Laucius <andrewla@gmail.com>
Authored original code and tests in #3240. I rewrote most of the
resizing code and fixed the failing tests.
2018-08-24 04:13:03 +03:00
Orestis Floros db294f4505
Improve resize_graphical_handler code style
- int return type is not useful
- Consistent comment style
2018-08-23 22:04:22 +03:00
Orestis Floros 6e1b79e057
Introduce orientation_from_direction 2018-08-23 15:36:23 +03:00
livanh c0378f737b Improve resize_find_tiling_participants() and simplify cmd_resize_tiling_width_height() (#3111) 2018-01-06 17:59:27 +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
Alex Auvolat 19fd6817af Refactor extern definition of conn and root_screen 2015-12-29 12:47:12 +01:00
Ingo Bürk a4afd1b642 Parse colors as color_t instead of colorpixel.
With this patch we remove the temporary draw_util_colorpixel_to_color
function we introduced previously by parsing the colors as color_t to
begin with.

relates to #1278
2015-11-23 22:18:02 +01: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
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 144e3fba2a render resize windows retina-correctly 2014-05-02 17:11:48 +02:00
Peter Boström 38b6936c25 Size resizebar according to container size. 2014-01-01 15:21:33 +01:00
Tony Crisci 69ce33d06d Snap pointer to resize bar on drag resize
When the user initiates a drag resize, draw the resize bar on the border
of the two involved containers and snap the pointer.

This solution produces cleaner code than the former approach where the
caller obfuscated the click coordinates of the event. This may confuse
someone expecting a true button press event.

Fixes an issue where the resize cursor is not shown when the resize bar
is clicked until the user begins to drag the mouse.

Fixes an issue where focus is not properly updated after the drag is
complete when `focus_follows_mouse' option is set, leaving the pointer
in an unfocused window in some cases.

Fixes an issue where the resize bar may jump a few pixels when the mouse
is first moved.

(Thanks to pbos for suggesting this fix and providing an example
implementation)
2014-01-01 15:18:54 +01:00
Tony Crisci 9ee26a608e Return DRAG_ABORT on UnmapNotify from drag_pointer
Add DRAG_ABORT to enum drag_result_t. DRAG_ABORT will indicate the drag
operation cannot be completed.

Return DRAG_ABORT on UnmapNotify, or when the keyboard or pointer cannot
be grabbed.

Add DRAGGING to return value for drag_result_t. DRAGGING is used
internally by drag_pointer to indicate the drag is in progress.

Change DRAG_CANCEL to DRAG_REVERT to clarify the distinction between
"abort" and "revert/cancel" actions.

Fixes an issue that caused i3 to crash when a user is dragging or
resizing a floating window that becomes destroyed.
2013-11-09 13:27:42 +01:00
Tony Crisci 459490b67b Add ability to escape out of a mouse-resize operation
Implement #1074. drag_cancel grabs the keyboard and returns DRAG_CANCEL
when the user presses any key during the grab.
2013-09-30 22:54:11 +02:00
jj dbec5eb905 Fix keyboard and mouse resize in nested containers
fixes #1084
fixes #1085
2013-09-26 19:30:07 +02:00
Deiz b235c469c1 Display appropriate cursors when resizing or moving floating windows. 2012-09-23 22:05:19 +02:00
Michael Stapelberg 884627ef20 use I3__FILE__ for DLOG, leave __FILE__ as is
See also commit 0e752070ac, which broke
source code listings in gdb unless you cd into i3/src. This should give
us best of both :-).
2012-08-12 12:19:47 +02:00
Michael Stapelberg 0e752070ac explicitly set filenames to $(basename __FILE__)
This makes the debug log a bit more readable, especially since commit
48f1e383ca
2012-08-07 09:55:52 +02:00
darkraven 9d68d780e2 Use 32bit visual only when needed. Thus we could drop the --enable-32bit-visual option. 2012-03-26 16:50:44 +02:00
Michael Stapelberg 664e30903c Bugfix: Don’t change focus after (graphical) resizing 2011-12-17 18:47:29 +00:00
Michael Stapelberg ed66a30410 mark parameters const 2011-11-10 19:17:36 +00:00
Michael Stapelberg 42d355f2b7 normalize modelines/headers across src/*.c 2011-10-22 23:40:02 +01:00
Fernando Tarlá Cardoso Lemos 568cafd4ec Fix the resize algorithm I broke earlier.
The reason it was broken was that it was ok for the sum of the
percentages to be something other than 1.0. Now this is no longer
the case, the sum of the percentages must always be 1.0 or an
assertion will fail when we render the containers.
2011-01-27 13:00:14 +01:00
Michael Stapelberg ee45c92564 Implement resizing (still buggy)
Committing basic resizing functionality. We need testcases for the bugs and
then eliminate them.
2010-11-29 10:56:16 +01:00
Michael Stapelberg a79d33fc7f Remove some dead code (to be re-implemented), rename nc.c to main.c 2010-07-11 22:12:25 +02:00
Michael Stapelberg 85308715ea Turn nested functions into real functions or macros
This enables compilation with llvm-clang and thus closes ticket #101.
While it makes the code more ugly, I don’t see a beautiful solution
which would enable us to stay with the more elegant solution of
nested functions and still allow compilation with any other compiler
than gcc.
2010-03-07 19:00:34 +01:00
Michael Stapelberg 8d648b4e37 Update function names, variable names and documentation for the RandR changes 2010-03-05 16:18:41 +01:00
Michael Stapelberg 818e02ef35 huge change: implement RandR instead of Xinerama
Thanks to Merovius for doing a proof of concept on this one and
being a driving force behind the idea.

Using RandR instead of Xinerama means that we are now able to use
the full potential of the modern way of configuring screens. That
means, i3 now has an idea of the outputs your graphic driver
provides, which allowed us to get rid of the ugly way of detecting
changes in the screen configuration which we used before. Now, your
workspaces should not be confused when changing output modes anymore.

Also, instead of having ugly heuristics to assign your workspaces
to (the screen at position X or the second screen in the list of
screens) you will be able to just specify an output name.

As this change basically touches everything, you should be prepared
for bugs. Please test and report them!
2010-03-02 12:47:21 +01:00
Kim Silkebækken (lokaltog) 148547c765 Fixed cursor orientation when resizing 2010-01-26 11:28:37 +01:00
Michael Stapelberg 6ef0d1fa79 Touch each log message and classify it as DLOG (debug), ELOG (error) or LOG (verbose) 2009-12-19 22:40:23 +01:00
Michael Stapelberg 52945486fd Bugfix: Also fix horizontal resizing
The same problem as in the commit before this one was present. Additionally,
the dock_clients and internal bar were not taken into account everywhere.
2009-11-22 14:32:40 +01:00
Michael Stapelberg 2c8b041500 Bugfix: Correctly calculate width when resizing (Thanks Merovius) 2009-11-22 14:05:35 +01:00
Michael Stapelberg a55d0b77fe Implement resize command
Syntax: resize <left|right|up|down> [+|-]<pixels>
2009-09-26 17:18:50 +02:00
Michael Stapelberg 2493c4b232 Bugfix: Fix resizing on second monitor (Thanks litemotiv)
We now use the virtual screen’s size/position instead of the X root
window for the grabwin (grabwin = the area in which the pointer may
move when resizing).
2009-09-25 18:08:37 +02:00
Michael Stapelberg e893902585 Implement horizontal resize 2009-09-06 16:50:45 +02:00
Michael Stapelberg af3972aa9f Bugfix: Recognize clicks as client clicks (opposed to border_clicks) when clients send them for their parent window
See comment, happened for example with xfontsel. You normally got
to see the resize bar (when having >1 column, of course).
2009-08-04 22:47:42 +02:00
Michael Stapelberg 163c9ad7db Map window/its decoration *after* calling render_layout()
Thus, no more flickering because the window was first mapped and then
moved. Especially users of multiple monitors should be happy now ;-).
Rather radical change, though, so be prepared for problems.
2009-07-25 22:29:28 +02:00
Michael Stapelberg 7773a3e5dd Ensure a minimum size of 25px when resizing windows 2009-06-24 18:31:43 +02:00
Michael Stapelberg 607b1d071e Use drag_pointer from floating.c for the resize handler 2009-06-24 17:40:34 +02:00
Michael Stapelberg ee217523f1 Bugfix: resizing: boundary checking (Thanks Mirko) 2009-06-24 17:24:09 +02:00
Michael Stapelberg 1256730b4b Bugfix: Fix display/resizing of colspanned containers 2009-05-09 18:43:50 +02:00
Michael Stapelberg 5b4f10eaca Bugfix: Store width_factor/height_factor per workspace, not per container
This is a relatively big change, however all cases should be handled by
now.

Because the function to do graphical resizing got rather large, I’ve created
a new file src/resize.c for it.

This fixes ticket #35.
2009-05-09 17:50:51 +02:00