== Obtaining the debug logfile
+Please note that log files may contain sensitive data such as window titles.
+The best way to avoid submitting such information is to only run the necessary
+applications to reproduce the behavior when saving the log file. This will also
+make analyzing the log file easier.
+
No matter whether i3 misbehaved in some way without crashing or whether it just
crashed, the logfile provides all information necessary to debug the problem.
int offset = walk->rect.w - statusline_width - tray_width - logical_px(sb_hoff_px);
x = original_x - offset;
- if (x >= 0) {
+ if (x >= 0 && (size_t)x < statusline_width) {
struct status_block *block;
int sep_offset_remainder = 0;
void draw_bars(bool unhide) {
DLOG("Drawing bars...\n");
int workspace_width = 0;
+ /* Is the currently-rendered statusline using short_text items? */
+ bool rendered_statusline_is_short = false;
refresh_statusline(false);
uint32_t max_statusline_width = outputs_walk->rect.w - workspace_width - tray_width - 2 * logical_px(sb_hoff_px);
/* If the statusline is too long, try to use short texts. */
- if (statusline_width > max_statusline_width)
+ if (statusline_width > max_statusline_width) {
+ /* If the currently rendered statusline is long, render a short status line */
refresh_statusline(true);
+ rendered_statusline_is_short = true;
+ } else if (rendered_statusline_is_short) {
+ /* If the currently rendered statusline is short, render a long status line */
+ refresh_statusline(false);
+ rendered_statusline_is_short = false;
+ }
/* Luckily we already prepared a seperate pixmap containing the rendered
* statusline, we just have to copy the relevant parts to the relevant
return;
}
+ if (output->connection == XCB_RANDR_CONNECTION_DISCONNECTED) {
+ DLOG("Disabling output %s: it is disconnected\n", new->name);
+ new->to_be_disabled = true;
+ return;
+ }
+
bool updated = update_if_necessary(&(new->rect.x), crtc->x) |
update_if_necessary(&(new->rect.y), crtc->y) |
update_if_necessary(&(new->rect.width), crtc->width) |
if (config.default_orientation == NO_ORIENTATION) {
Con *output = con_get_output(ws);
ws->layout = (output->rect.height > output->rect.width) ? L_SPLITV : L_SPLITH;
+ ws->rect = output->rect;
DLOG("Auto orientation. Workspace size set to (%d,%d), setting layout to %d.\n",
output->rect.width, output->rect.height, ws->layout);
} else {
--- /dev/null
+#!perl
+# vim:ts=4:sw=4:expandtab
+#
+# Please read the following documents before working on tests:
+# • http://build.i3wm.org/docs/testsuite.html
+# (or docs/testsuite)
+#
+# • http://build.i3wm.org/docs/lib-i3test.html
+# (alternatively: perldoc ./testcases/lib/i3test.pm)
+#
+# • http://build.i3wm.org/docs/ipc.html
+# (or docs/ipc)
+#
+# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
+# (unless you are already familiar with Perl)
+#
+# Ensures that 'move workspace $new, floating enable' on a marked window
+# leaves the window centered on the new workspace.
+# Bug still in: 4.10.2-137-ga4f0ed6
+use i3test i3_autostart => 0;
+
+my $config = <<EOT;
+# i3 config file (v4)
+font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
+
+new_window none
+new_float none
+EOT
+
+my $pid = launch_with_config($config);
+
+#####################################################################
+# Open a tiled window, and then simultaneously move it to another
+# workspace and float it, ensuring that it ends up centered.
+#####################################################################
+
+my $window = open_window;
+my $unused = get_unused_workspace();
+
+cmd "mark foo; [con_mark=\"foo\"] move workspace $unused, floating enable";
+
+sync_with_i3;
+
+my $pos = $window->rect;
+
+is(int($pos->{x} + $pos->{width} / 2), int($x->root->rect->width / 2),
+ 'x coordinates match');
+is(int($pos->{y} + $pos->{height} / 2), int($x->root->rect->height / 2),
+ 'y coordinates match');
+
+exit_gracefully($pid);
+
+done_testing;