]> git.sur5r.net Git - i3/i3/commitdiff
Merge pull request #1689 from Airblader/feature-docs-4
authorMichael Stapelberg <stapelberg@users.noreply.github.com>
Sun, 3 May 2015 09:28:45 +0000 (02:28 -0700)
committerMichael Stapelberg <stapelberg@users.noreply.github.com>
Sun, 3 May 2015 09:28:45 +0000 (02:28 -0700)
Debugging docs – minimal setup, small log file, closed source software

docs/debugging
i3bar/src/xcb.c
src/randr.c
src/workspace.c
testcases/t/244-new-workspace-floating-enable-center.t [new file with mode: 0644]

index 5187c529b4ed7ba69c088e11fcb8c33b4e3a8782..cf61813d4789b52c1c4791f4b28f92698c73e4b2 100644 (file)
@@ -93,6 +93,11 @@ issue with the software in question, not i3.
 
 == 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.
 
index fd268e9189400a7353c0ab65093cc0e6b1fc7bf9..11a017cf386224be3054596692a48ea1eb120b99 100644 (file)
@@ -420,7 +420,7 @@ void handle_button(xcb_button_press_event_t *event) {
         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;
 
@@ -1792,6 +1792,8 @@ void reconfig_windows(bool redraw_bars) {
 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);
 
@@ -1941,8 +1943,15 @@ void draw_bars(bool unhide) {
             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
index 29183695c99a705d5a10febf5483aef96d34113e..9e236dcb517e8bab4214dba72821f4d5a3e10a12 100644 (file)
@@ -555,6 +555,12 @@ static void handle_output(xcb_connection_t *conn, xcb_randr_output_t id,
         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) |
index 9034f6d5957cd643da1809a8beba50835df26f7a..c7f1a1bbc0605a30257a72c4bf41511b737b6b46 100644 (file)
@@ -29,6 +29,7 @@ static void _workspace_apply_default_orientation(Con *ws) {
     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 {
diff --git a/testcases/t/244-new-workspace-floating-enable-center.t b/testcases/t/244-new-workspace-floating-enable-center.t
new file mode 100644 (file)
index 0000000..dbc9a80
--- /dev/null
@@ -0,0 +1,53 @@
+#!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;