apocalyptech / eschalon_utils

Eschalon Books I, II, and III Character and Map Editors
http://apocalyptech.com/eschalon/
GNU General Public License v2.0
8 stars 3 forks source link

on_mouse_changed() clobbers tile_x and tile_y coordinates mid-edit #61

Closed elliotkendall closed 10 years ago

elliotkendall commented 10 years ago

Woo, this is a good one. You click on a tile with edit mode active and the Edit Item Details window appears (should be called Edit Tile Details instead?). Maybe the window appears somewhere other than where your mouse cursor is, so you move it across the still-open main map editor window to get to the Edit Item Details window. Every time your cursor crosses a map square, on_mouse_changed changes the self.tile_x and self.tile_y to that square's coordinates. Now your edit window is silently editing some other tile!

There seem to be two ways to fix this: prevent on_mouse_changed changing the coordinates while an edit window is open, or store x and y location with the edit window somehow so it doesn't matter if the ones in the MapGUI object get changed.

apocalyptech commented 10 years ago

Good indeed! I wonder if it's something to do with how your window manager's handling the windows... I actually can't reproduce that on my end. As soon as the edit window's open (yeah, we should rename that) the main window becomes effectively unresponsive - my on_mouse_changed() doesn't fire off in those circumstances.

Regardless, there'd certainly be no harm in adding an extra check to on_mouse_changed, though I'd be interested to find out what combination of WM brings out this bug.

elliotkendallUCSF commented 10 years ago

Yeah, I suspected it might be something specific to me. Otherwise it's hard to believe people have made successful mods without noticing it. I'm on sawfish with enter-only focus-follows-mouse and 500 ms auto-raise.

apocalyptech commented 10 years ago

Hm, I'm actually still not able to reproduce that... Maybe send me over your ~/.sawfish/custom? This is what I've got now:

;; Sawfish user customization -- do not edit by hand!
;; Use the configurator instead.
;; sawfish version 1.10, written Wed Apr 23 11:59:34 2014

(custom-set-typed-variable (quote raise-windows-on-focus) (quote t) (quote boolean) (quote sawfish.wm.ext.auto-raise))
(custom-set-typed-variable (quote focus-click-through) (quote t) (quote boolean))
(custom-set-typed-variable (quote default-frame-style) (quote StyleTab) (quote frame-style))
(custom-set-typed-variable (quote focus-dont-push) (quote ()) (quote boolean))
(custom-set-typed-variable (quote focus-mode) (quote enter-only) (quote symbol))
elliotkendallUCSF commented 10 years ago

I have two systems with (nearly) identical configs, and I can't reproduce it on the other one, either. I'll do some more testing on the affected one, but it's good to know that this is probably a very uncommon problem.

elliotkendall commented 10 years ago

Here's ~/.sawfish/custom:

;; sawfish user customization -- do not edit by hand!
;; sawfish version 1.5.3, written Fri Apr 11 19:18:04 2014

(custom-set-typed-variable (quote default-frame-style) (quote AquaX) (quote frame-style))
(custom-set-typed-variable (quote pager-shrink-factor) (quote 38) (quote number))
(custom-set-keymap (quote global-keymap) (quote (keymap (move-cursor-right . "S-Right") (cycle-windows . "M-TAB") (xterm . "F12") (move-cursor-left . "S-Left") (move-cursor-down . "S-Down") (move-cursor-up . "S-Up") (move-viewport-right . "C-Right") (move-viewport-left . "C-Left") (move-viewport-down . "C-Down") (move-viewport-up . "C-Up") (xterm . "Pause"))))
(custom-set-keymap (quote title-keymap) (quote (keymap (move-window-interactively . "Button1-Move") (toggle-window-shaded . "Button1-Off2") (resize-window-interactively . "Button2-Move") (raise-lower-window . "Button3-Off"))))
(custom-set-typed-variable (quote match-window-profile) (quote ((((WM_NAME . "^pager$") (WM_CLASS . "^Pager/pager$")) (position 1199 . 0) (frame-type . none) (sticky . #t) (sticky-viewport . #t)) (((WM_NAME . "^Workrave$") (WM_CLASS . "^Workrave/workrave$")) (position 1199 . 218) (frame-type . none)) (((WM_NAME . "^gkrellm$") (WM_CLASS . "^Gkrellm/gkrellm$")) (position 1199 . 107) (frame-type . none) (sticky . #t) (sticky-viewport . #t)))) (quote match-window) (quote sawfish.wm.ext.match-window))
(custom-set-typed-variable (quote xterm-program) (quote "~/bin/myterm") (quote string))
(custom-set-typed-variable (quote edge-flip-type) (quote viewport) (quote (choice viewport workspace)))
(custom-set-typed-variable (quote edge-flip-enabled) (quote t) (quote boolean) (quote sawfish.wm.ext.edge-flip))
(custom-set-typed-variable (quote move-lock-when-maximized) (quote ()) (quote boolean))
(custom-set-typed-variable (quote pager-color-window) (quote "#35ad35adffff") (quote color))
(custom-set-typed-variable (quote pager-color-workspace-divider) (quote "#ffffffffffff") (quote color))
(custom-set-typed-variable (quote pager-color-viewport-divider) (quote "#dce6dce6dce6") (quote color))
(custom-set-keymap (quote maximize-button-keymap) (quote (keymap (maximize-fill-window-toggle . "Button1-Off") (maximize-window-vertically-toggle . "Button2-Off") (maximize-window-horizontally-toggle . "Button3-Off"))))
(custom-set-typed-variable (quote pager-color-viewport) (quote "#c96cfd64ffff") (quote color))
(custom-set-typed-variable (quote pager-color-background) (quote "#ffffffffffff") (quote color))
(custom-set-typed-variable (quote pager-tooltips-enabled) (quote t) (quote boolean))
(custom-set-typed-variable (quote pager-show-all-workspaces) (quote ()) (quote boolean))
(custom-set-typed-variable (quote error-destination) (quote standard-error) (quote (choice nowhere screen standard-error)))
(custom-set-typed-variable (quote workspace-names) (quote ("1")) (quote (list string "Workspace names")))
(custom-set-typed-variable (quote pager-workspaces-per-column) (quote 5) (quote number))
(custom-set-typed-variable (quote pager-focus) (quote ()) (quote boolean))
(custom-set-typed-variable (quote pager-stickies-on-all-viewports) (quote ()) (quote boolean))
(custom-set-typed-variable (quote pager-stickies-on-all-workspaces) (quote ()) (quote boolean))
(custom-set-keymap (quote window-keymap) (quote (keymap (raise-and-pass-through-click . "Button1-Click") (move-window-interactively . "C-S-Button1-Click") (move-window-interactively . "W-Button1-Move") (popup-window-menu . "W-Button2-Click") (raise-lower-window . "W-Button3-Click") (lower-window . "W-Down") (raise-window . "W-Up"))))
(custom-set-typed-variable (quote aquax:button-layout) (quote MS-Windows) (quote symbol))
(custom-set-typed-variable (quote place-window-mode) (quote first-fit) (quote symbol))
(custom-set-typed-variable (quote error-handler-beep) (quote ()) (quote boolean))
(custom-set-typed-variable (quote raise-windows-on-focus) (quote t) (quote boolean) (quote sawfish.wm.ext.auto-raise))
(custom-set-typed-variable (quote focus-click-through) (quote ()) (quote boolean))
(custom-set-typed-variable (quote focus-mode) (quote enter-only) (quote symbol))
(custom-set-typed-variable (quote Crux:button-theme) (quote windows) (quote (choice (default "Default") (platinum "Mac OS Platinum") (macos-x "Mac OS X") (windows "MS Windows") (next "NeXTSTEP"))))

And here's ~/.sawfishrc:

(require 'sawfish.wm.ext.edge-flip)
(require 'sawfish.wm.ext.auto-raise)
(setq move-snap-mode 'magnetism)
(setq move-cursor-increment 100)

(define-special-variable customize-command-classes '(viewport default)
    "Also include commands of these classes the key bindings panel.
Add the `viewport' keyboard to make viewport commands show up.")

(define-special-variable viewport-dimensions '(3 . 5)
    "Size of each virtual workspace.")
elliotkendall commented 10 years ago

Hm. This doesn't seem to be a window manager problem, either. I can reproduce it on my home system in Sawfish, whatever the default Gnome WM is in Ubuntu 14.04, TWM, FVWM, and no WM at all. Anyway, I've got a patch that fixes it for me and shouldn't impact anyone else.

apocalyptech commented 10 years ago

Huh, strange, I still can't reproduce on my end.

Well, whatever - the fix is simple enough, anyway, so I'm happy with that. :)