Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2017
416
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.50 KB | None | 0 0
  1. <dinamic> i have a few questions regarding the keyaccel imlpementation
  2. <dinamic> bieber_, how should i handle keyaccels in a plugin that is shared among views eg. accessable in both lighttable and darkroom for example..
  3. <bieber_> Hmm
  4. <bieber_> I suppose you'd have to add the accelerator to both views
  5. <dinamic> hmm
  6. <dinamic> thats not doable
  7. <dinamic> hmm this is getting messy the more i think of it..
  8. <dinamic> lets say we have a keyaccel shared among vies
  9. <dinamic> views
  10. <dinamic> that will end up in several keyacel paths
  11. <bieber_> I'd have to rewrite the view-switching accel system to allow them to be shared. Currently a separate list is stored for each view, in this case we'd want a single list withh flags for each accel indicating the views it exists in
  12. <dinamic> and when user configures using the preference pane he need to find 3 places for a single function to be consitetn thru the views
  13. <bieber_> Multiple keys could be a good thing, though
  14. <dinamic> consitensy is better then ability
  15. <dinamic> :)
  16. <bieber_> Hmm
  17. <dinamic> let say left arrow goes to next image in filmstrip
  18. <dinamic> but only darkroom and not in tethering view
  19. <dinamic> because user didnt search all the filmstrip left image
  20. <dinamic> to make it consisten
  21. <dinamic> among the views
  22. <dinamic> couldn't the key be linked somehow ?
  23. <dinamic> oh wait!
  24. <bieber_> The problem there is that that code belongs to the view, doesn't it?
  25. <dinamic> i think i have it..
  26. <dinamic> let's preference pane update all keys
  27. <dinamic> x/y/z/key/action
  28. <dinamic> where last key+action = same
  29. <dinamic> and the key assigned
  30. <dinamic> nah
  31. <dinamic> hmm
  32. <dinamic> grrr
  33. <dinamic> need a smoke
  34. <dinamic> :)
  35. <dinamic> bieber, filmstrip view is in a module now
  36. <dinamic> bieber_, locally ^
  37. <dinamic> :)
  38. <dinamic> ill push it tonite
  39. <dinamic> just cleaning it up now..
  40. <bieber_> Hmm
  41. <dinamic> brb
  42. <bieber_> Auto-reassigning multiple keys seems like potentially confusing behavior
  43. <bieber_> Okay
  44. <dinamic> hmm
  45. <dinamic> yea i figured
  46. <dinamic> maybe wee need too reconsidering the key path structure
  47. * prokoudine__ is now known as prokoudine
  48. <dinamic> we have 3 types of plugins
  49. * prokoudine has quit (Quit: Ex-Chat)
  50. <dinamic> views, plugins (not specific to a view), iop modules
  51. <dinamic> so maybe something like:
  52. * prokoudine (~avp@ppp85-141-150-202.pppoe.mtu-net.ru) has joined #darktable
  53. <dinamic> this mess:
  54. <dinamic> ../views/lightable/mode
  55. <dinamic> ../plugins/collection ../plugins/export
  56. <dinamic> ../iop/highpass
  57. <dinamic> probably something better then iop
  58. <dinamic> like
  59. <dinamic> ../processing modules/higpass
  60. <dinamic> plugins might have a better name
  61. <dinamic> like panels
  62. <dinamic> or somethign
  63. <bieber_> That could work
  64. <dinamic> that removes the view dependecy that exists today
  65. <bieber_> I've got to run for now, I'll be back later
  66. <dinamic> 4 main groups: globals, views,panels, modules
  67. <dinamic> yeap
  68. * bieber_ has quit (Remote host closed the connection)
  69. <dinamic> cya around
  70. * bremner has quit (Read error: Operation timed out)
  71. * bremner (~bremner@yantan.tethera.net) has joined #darktable
  72. * mmiicc has quit (Quit: Leaving.)
  73. * rip-someday (~rip@executiveness.sky.volia.net) has joined #darktable
  74. * paka (~paka@50-90-97-150.res.bhn.net) has joined #darktable
  75. * paka has quit (Remote host closed the connection)
  76. <dinamic> greate
  77. <dinamic> new filmstrip module pushed to post-0.9
  78. * jcsogo (~AndChat@31.Red-83-45-118.dynamicIP.rima-tde.net) has joined #darktable
  79. * KostyaSha (~gentoo@178.120.16.86) has joined #darktable
  80. <prokoudine> dinamic, and I see that you pushed masks too
  81. <bieber> dinamic: We could rearrange the accel groups to group by modules, libs, and views, the problem just then becomes deciding how to handle adding/removing them
  82. <bieber> The reason they're currently grouped by view is so that we can just detach/attach the apropriate groups during a view change, and everything plays nice
  83. <dinamic> biebier, so all modules should have: attach_key_accel() dettach_key_accel() ?
  84. <dinamic> and the use their corresponding module typ api
  85. <dinamic> like libs:
  86. <dinamic> dt_lib_attach_key_accel().
  87. <dinamic> dt_iop_attach_key_accel
  88. <dinamic> dt_view_attach_key_accl
  89. <bieber> Yeah, we could just handle everything by connecting/disconnecting the individual accelerators
  90. <bieber> Here's a thought
  91. <bieber> Rewrite dt_accel_group_connect_by_path so that instead of a group, it accepts a flags argument for the views in which the shortcut should be active
  92. <bieber> Then on view change we can just comb through the flags and connect/disconnect apropriately
  93. <dinamic> prokoudine, yea i merged post-0.9 into it too see how much problem i would get :).. minimal problems..
  94. * rip-someday has quit (Ping timeout: 264 seconds)
  95. <dinamic> bieber, i dont think you should build something view dependent into keyaccels
  96. <dinamic> view.c does the job for us
  97. <dinamic> it loads/unloads plugin when switching view
  98. <dinamic> so in the unload loop disconnect them..
  99. <bieber> That would be nice, it just leaves the problem of remapping
  100. <dinamic> and in the load loop connect
  101. <bieber> The remap code has to be able to tell which accelerators can conflict with each other, so they have to have some notion of the views they're active in
  102. <dinamic> bieber, how soo ?
  103. * jcsogo has quit (Ping timeout: 276 seconds)
  104. <dinamic> bieber, im not following that
  105. <dinamic> s/following/understand
  106. <bieber> When the user remaps a key, the interface has to delete any mappings that can conflict with it
  107. <bieber> However, multiple accelerators can be mapped to the same key, as long as they're only ever active in different views
  108. <bieber> So currently, if you remap a key in the lighttable group, say, it won't delete any matching bindings in the darkroom group
  109. <dinamic> why keep mappings view dependent ?
  110. <bieber> It's necessary if you want the same key to do different things in different views
  111. <houz> speaking of which, didn't you want to add context to the accel strings generated when compiling? it should just be a matter of replacing _(XXX) by C_("accel", XXX)
  112. <dinamic> why would one want that ?
  113. <bieber> If we just check every single accelerator for conflicts, then if you use a key in one view you lose the ability to use it in the others
  114. <dinamic> not if the module isnt loaded in that view
  115. <dinamic> take post-0.9 for example,
  116. <bieber> houz: Is that a macro or a function? I was having trouble finding the corresponding function to actually look up the transations with context in the UI, I think
  117. <dinamic> rating tool in topbar left box..
  118. <dinamic> i ment the colorlabels..
  119. <bieber> I could find one in glib that took a domain and a context, but not one that just took a context?
  120. <dinamic> let's say that tool have the key_accels for assigning colorlabel
  121. <houz> that the same as _(). just use it in accelstrings_gen.h
  122. <houz> grep for C_() in our sources
  123. * jcsogo (~AndChat@31.Red-83-45-118.dynamicIP.rima-tde.net) has joined #darktable
  124. * paka (~paka@50-90-97-150.res.bhn.net) has joined #darktable
  125. <bieber> dinamic: The problem with that is that we have no programatic way of determining which tools will necessarily be active at the same time. We can check for conflicts in the currently loaded set of modules, but we have no way of ascertaining what modules may be loaded at the same time in other situations
  126. <bieber> Oh wait, libs already have a views() callback, so I guess we can just use that
  127. <dinamic> :)
  128. <dinamic> yeapp
  129. <dinamic> iop = always darkroom
  130. <dinamic> libs = determined by views()
  131. <dinamic> views =.. views :)
  132. <bieber> Okay, so how does this sound
  133. <bieber> Every lib/iop can have the usual init_accels() callbaack, as well as a connect_accels() and disconnect_accels() that will be called at load and unload
  134. <bieber> And I guess something similar for views as well
  135. <dinamic> bieber, yea thats cleaner then connect/disconnect accesl in gui_init() / cleanup()
  136. * rip-someday (~rip@executiveness.sky.volia.net) has joined #darktable
  137. <bieber> Definitely
  138. <bieber> I probably should have thought of something like that while I was writing all the connect()/disconnect() code in the various modules
  139. <bieber> I'll also have to figure out how boucman's modifications to the various GUI widgets have been working and get them to play nice as well
  140. <dinamic> ahright
  141. * glutko (~glutko@93-96-145-167.zone4.bethere.co.uk) has left #darktable
  142. <dinamic> to the next question about keyaccels
  143. <dinamic> how do one make a window specific mapping ?
  144. <dinamic> for a stubborn example:
  145. <dinamic> if i want enter to activate image under mouse in filmstrip
  146. <dinamic> and i have crop rotate module active
  147. <dinamic> :)
  148. <dinamic> how would one control key to specific window ?
  149. <dinamic> the old impl, pushed it further down a chain
  150. <bieber> Well, there's definitely no official GTK support for something like that
  151. <dinamic> for sure..
  152. <bieber> The solution we decided on at the beginning of the Summer was just to make all shortcuts global, because having different shortcuts activate depending on the mouse position would become exceedingly confusing for the user
  153. <dinamic> but our old key handler handled that
  154. <dinamic> so contextual key accelerators are confusing ?
  155. <dinamic> i guess not
  156. <bieber> Definitely when everything is in the same GTK window
  157. <dinamic> its confusing wanting to do this, but that carries out
  158. <bieber> If you wanted to implement something like that, first you'd have to decide whether you want it to depend on what widget has focus according to GTK, or what widget has the mouse over it
  159. <dinamic> i want it to be controlled as before
  160. <dinamic> like focused module
  161. <bieber> Then you'd just need to connect/disconnect the accelerator in functions attached to the mouse enter/leave or focus in/out signals of the widget
  162. <dinamic> its pretty enough to have something like that
  163. <dinamic> soo
  164. <dinamic> connect_accels(gboolean global)
  165. <dinamic> then..
  166. <dinamic> :)
  167. <dinamic> and let the view connect mouse enter/leave and dispatch (dis)connect_accels(TRUE)
  168. <dinamic> ok, i see its doable
  169. <dinamic> not that we need it for now i guess
  170. <dinamic> but we sure will need it in the future
  171. <bieber> Focus-dependent accelerators remove a lot of the convenience of keyboard shortcuts to begin with, keep in mind
  172. <dinamic> no it doesnt
  173. <dinamic> :)
  174. <bieber> If the user has to focus the module with the mouse to use it anyways, why not just add a button in the module?
  175. <dinamic> if crop backspace is global in view
  176. * jcsogo has quit (Ping timeout: 250 seconds)
  177. <dinamic> how is the old contextual key accels handled ?
  178. <dinamic> like crop for example
  179. <bieber> I _think_ they just activated depending on whether the desired module had focus
  180. <bieber> The old system did everything manually by comparing keycodes on key_pressed events
  181. <dinamic> bieber that what im talking about..
  182. <dinamic> take crop for example
  183. <dinamic> enter crops the image..
  184. <dinamic> if you size the crop are, then leavs for another module
  185. <dinamic> and do something else..
  186. <dinamic> hit enter and the image will be cropped
  187. <dinamic> even if you donr have th crop module in focus
  188. <dinamic> thats really an unexpected beahviour
  189. <dinamic> and thats why global key accels confuses users
  190. <dinamic> for example
  191. <bieber> It shouldn't actually do anything if you haven't changed the crop mask, though
  192. <dinamic> but you get the opint right..
  193. <bieber> Yeah
  194. <dinamic> whatever is hiding behind a bound key is carried out wherever you are in a view
  195. <dinamic> and you have no clue..
  196. <dinamic> why
  197. <bieber> If you're doing a lot of editing with accelerators, though, you _expect_ to be able to carry out functions with accelerators even if their underlying modules aren't currently visible
  198. <dinamic> why crop if you didnt changed the mask ?
  199. <dinamic> :)
  200. <dinamic> take enter for an example
  201. <dinamic> a very good key
  202. <dinamic> to carry out an action
  203. <dinamic> as for crop
  204. <dinamic> as for activate somethign other
  205. <dinamic> etc..
  206. <dinamic> but we could only have enter mapped to one iop module and the whole view cant reuse it
  207. * houz has quit (Quit: Verlassend)
  208. <bieber> I think it would be a useful feature for some modules, but not many
  209. <bieber> In most cases you wouldn't want to have to pull up the module to make an adjustment if you don't need to use the mouse for it
  210. * prokoudine has quit (Quit: Ex-Chat)
  211. <dinamic> bieber, in most cases you WANT to have the modul up front, some of them and more will have overlay ui control etc..
  212. <dinamic> i really dont understand that last argument..
  213. <dinamic> you want to crop a mask without setting the mask ?
  214. <dinamic> and you dont want to drag a slider to change a value ?
  215. <dinamic> im not following you here, my point is, that NO iop module should have GLOBAL key accels
  216. <dinamic> except for enable/disable etc..
  217. <dinamic> the view common thingy for iop
  218. <bieber> In those use cases, though, I'm already going to be bringing up the iop with a mouse, so I wouldn't need the key accels to begin with
  219. <dinamic> then plugins such as history/snapshots
  220. <dinamic> need both local/global key accels
  221. <bieber> That could work
  222. <dinamic> usally plugins will use global key accels..
  223. <dinamic> like history compress etc..
  224. <dinamic> but some want locals to..
  225. <dinamic> as for the mask module im working on
  226. <dinamic> sure i connect/disconnect on module focus but the api should allow the use of it..
  227. <dinamic> for example..
  228. <dinamic> as i mention before, the gboolean flag to connect/disconnect_accels()
  229. <dinamic> and handle the call to them automatically when module is focused unfocused
  230. <dinamic> i think that would solve the cases
  231. <bieber> Okay
  232. <bieber> I should be able to add that along with the new API without too much trouble
  233. <dinamic> and the last question..
  234. <dinamic> the mask editor will have some tools..
  235. <dinamic> to draw on canvas.. some tools have some key accels.. :)
  236. <dinamic> ofcourse
  237. <dinamic> those will be local keyaccels..
  238. <dinamic> hmm
  239. <bieber> Like tools within the module?
  240. <dinamic> yeap
  241. <bieber> What exactly is the mask editor? An iop or a view that gets loaded like the filmstrip?
  242. <dinamic> mask editor is a plugin that have some basic tools to draw a mask, that you can use with blending in iop
  243. <dinamic> basically
  244. <dinamic> enable local editing kidn of..
  245. <bieber> Hmm
  246. <dinamic> create a mask of face, remove eyes/lips etc from mask, then load the lowpass and blend with mask
  247. <dinamic> to soften out the skin
  248. <dinamic> etc..
  249. <dinamic> just like alpha channel in gimp for layer it will be used as alpha mask for an plugin
  250. <dinamic> the fist tool will be a closed curve that you can drag to a form, theni need some keyaccells just for the editing of the curve..
  251. <dinamic> those need to be local
  252. <dinamic> and should override the globals
  253. <dinamic> let say my tools have grow/shrink key accels..
  254. <dinamic> s and g
  255. * jcsogo (~AndChat@31.Red-83-45-118.dynamicIP.rima-tde.net) has joined #darktable
  256. <bieber> Hmm
  257. <dinamic> i need those local to be trigged even if there is a global s
  258. <bieber> I'd think it would probably be best just to make a special case for those?
  259. <dinamic> no
  260. <bieber> There aren't any other modules that have sub-tools like that, are there?
  261. <dinamic> because its not only there
  262. <dinamic> bieber, the overlays to crop/gnd/vignette can have ?!
  263. <bieber> Wouldn't those just be local to the module itself?
  264. <dinamic> yeap
  265. <dinamic> when module in focus, and is int this or that state
  266. <dinamic> anyway
  267. <dinamic> the local/global connect/disconnect solves it..
  268. <bieber> In that case the module really has to be responsible for managing which of its accels it wants active
  269. <bieber> Well, it solves module focus, it doesn't do anything about having specific tools selected or not
  270. <dinamic> noo
  271. <dinamic> it doesnt
  272. <dinamic> thats internals of module
  273. <dinamic> but as i say, local key accels should override global ones..
  274. <dinamic> thats a mandatory thing
  275. <bieber> Should they both be allowed to exist?
  276. <bieber> If there's a local accel that could possibly be activated in a view, I wouldn't want to allow global accels on the same key
  277. <bieber> Then the user has to know which particular accelerators the module they have in focus exposes, or else they won't know that their global accels just stopped working
  278. <dinamic> yes that is the outcome
  279. <dinamic> and its needed
  280. <dinamic> they cant coexists..
  281. <bieber> Right, so they shouldn't shadow each other, a key should just be considered taken once it has at least one local accel mapped to it
  282. <bieber> I think our conflict resolution code is about to get much more complicated :P
  283. <dinamic> how does gtk handle 2 mapped keys ?
  284. <dinamic> does it carry them out both
  285. <dinamic> or the last added ?
  286. <dinamic> are they stackable ?
  287. <dinamic> that would be sweet
  288. <dinamic> :)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement