Tk Source Code

Artifact [8066a866]
Login

Artifact 8066a8660902cc956b3728203205c28f4e1bc523b27d4abb065113ad93ce15af:

Ticket change [8066a866] - Ticket [1fb7af62] Add support for buttons 4 and 5 to Windows status still Open with 5 other changes by chrstphrchvz 2019-07-20 14:52:32.
D 2019-07-20T14:52:32.379
J comment The\sattached\spatch\sattempts\sto\sadd\ssupport\sfor\smouse\sbuttons\s4\sand\s5\sto\sTk\sfor\sWindows.\s(These\sbuttons\sare\scalled\sXButton1\sand\sXButton2\sin\sthe\sWindows\sAPI\sdocumentation.)\sCurrently,\sTk\sprograms\son\sWindows\sdo\snot\sdetect\sthese\sbuttons\sat\sall,\seven\swith\s<code>&lt;ButtonPress&gt;</code>.\sI\sbelieve\sthat\sthese\sbuttons,\sif\snot\srepurposed\sby\sthe\suser,\sshould\sbe\savailable\sto\sTk\sprograms,\sas\sthey\scurrently\sare\son\sAqua\s(as\sbuttons\s4\sand\s5)\sand\sX11\s(as\sbuttons\s8\sand\s9).\sOne\scommon\sbinding\sfor\sthese\sbuttons\sis\sfor\sback/forward\snavigation\sin\sbrowsers.\r\n\r\nI\sam\snot\ssure\sto\swhat\sextent\sthis\sfunctionality\shas\sbeen\srequested\sin\sthe\spast,\sor\swhether\sany\sefforts\swere\smade\sto\simplement\ssupport\sfor\sthem\s(either\sin\sTk\sor\sextensions).\sI\sfound\sone\sdiscussion\sfrom\s2011\son\scomp.lang.tcl:\s[https://groups.google.com/forum/#!msg/comp.lang.tcl/LpEULzrhjBI/gbNOyXyYMX4J].\sThe\snon-functionality\sof\sbuttons\s4\sand\s5\son\sWindows\swas\smore\srecently\smentioned\sin\sdiscussions\sregarding\sTIP\s#474.\r\n\r\n\r\nI\sbelieve\ssupport\sfor\sthese\sbuttons\scan\sbe\sadded\sto\s8.6,\sand\snot\shave\sto\swait\sfor\s8.7.\sThere\sis\sindeed\sa\slikelihood\sthat\sexisting\sprograms\sbind\sto\sbuttons\s4\sand\s5\sto\sallow\sscrolling\son\sX11,\syet\sfail\sto\srestrict\sthose\sbindings\sto\swhen\s<code>[tk\swindowingsystem]</code>\sis\s<code>"x11"</code>;\showever,\sthose\sprograms\salready\sexhibit\sthis\sissue\son\sAqua.\s(<strike>I\sinformed\sthe\sauthor\sof\sTIP\s#474\sthat\stheir\sexisting\simplementation\swould\sexhibit\sthis\sissue.</strike>\s<b>Edit:</b>\smaybe\sit\sdoesn't\saffect\sWindows…)\r\n\r\n\r\nThere\sis\sone\sdetail\sin\sthe\simplementation\sI\sam\snot\svery\scertain\sof:\swhether\s<code>wparam</code>\sshould\sonly\sbe\sassigned\s<code>MK_XBUTTON1</code>\sor\s<code>MK_XBUTTON2</code>,\srather\sthan\s<code>MAKEWPARAM(MK_XBUTTON1,\sXBUTTON1)</code>\sor\s<code>MAKEWPARAM(MK_XBUTTON2,\sXBUTTON2)</code>,\sin\sthe\sfollowing:\r\n<pre>\r\n@@\s-1783,6\s+1787,14\s@@\sTkWinResendEvent(\r\n\s\s\s\s\s\s\s\smsg\s=\sWM_RBUTTONDOWN;\r\n\s\s\s\s\s\s\s\swparam\s=\sMK_RBUTTON;\r\n\s\s\s\s\s\s\s\sbreak;\r\n+\s\s\s\scase\sButton4:\r\n+\s\s\s\s\s\s\smsg\s=\sWM_XBUTTONDOWN;\r\n+\s\s\s\s\s\s\swparam\s=\sMAKEWPARAM(MK_XBUTTON1,\sXBUTTON1);\r\n+\s\s\s\s\s\s\sbreak;\r\n+\s\s\s\scase\sButton5:\r\n+\s\s\s\s\s\s\smsg\s=\sWM_XBUTTONDOWN;\r\n+\s\s\s\s\s\s\swparam\s=\sMAKEWPARAM(MK_XBUTTON2,\sXBUTTON2);\r\n+\s\s\s\s\s\s\sbreak;\r\n\s\s\s\s\sdefault:\r\n\s\s\s\s\s\s\s\sreturn\s0;\r\n\s\s\s\s\s}\r\n</pre>\r\n\r\nI\sdo\snot\sknow\sexactly\swhat\s<code>TkWinResendEvent()</code>\sis\sused\sfor,\sbut\sI\simagine\sthat\sthe\sway\sI\shave\swritten\sthis\sallows\swhatever\sprocessing\sthe\sevent\sto\scheck\swhich\sbutton\sis\spressed\sfrom\s<code>HIWORD(wparam)</code>\s(e.g.\susing\sthe\s<code>GET_XBUTTON_WPARAM(wparam)</code>\smacro),\srather\sthan\sonly\sby\schecking\sfor\s<code>MK_XBUTTON1</code>\sor\s<code>MK_XBUTTON2</code>.\r\n\r\n\r\nOne\sscript\sfor\smanually\stesting\sthis:\r\n\r\n<pre>\r\npackage\srequire\sTk\r\n\r\nlabel\s.l\s-text\s"Click\shere"\s-height\s10\s-width\s30\r\npack\s.l\r\nbind\s.l\s<4>\s{puts\s"Button\s4\sclicked"}\r\nbind\s.l\s<5>\s{puts\s"Button\s5\sclicked"}\r\n</pre>\r\n\r\nTo\stest\sthis\swithout\san\sactual\s5-button\smouse,\sa\stool\sto\semulate\sthe\sbutton\spresses\scan\sbe\sused,\ssuch\sas\sAutoHotKey\swith\sa\sscript\sthat\smaps\skeypresses\sto\sbuttons\s4\sand\s5:\r\n\r\n<pre>\r\nF6::XButton1\r\n\r\nF7::XButton2\r\n</pre>\r\n\r\nI\shave\ssuccessfully\stested\sthis\simplementation\son\sWindows\s10\s1903\sx64,\sbased\son\stop\sof\srecent\score-8-6-branch\s[3e5c0ebb].
J icomment <blockquote>\sI'm\sa\sbit\sunsure\sabout\sthe\simpact\sof\sthis\simprovement\son\sTIP\s#474,\swhich\sin\sits\simplementation\s(in\sthe\sgeneric\scode,\ssee\s[77c390bae2700c72])\sturns\sbutton-4\sand\sbutton-5\sinto\sa\s&lt;MouseWheel&gt;\sevent.</blockquote>\r\n\r\nHere's\sthe\sthread\swith\smy\sfeedback\sto\sthe\sauthor\sof\sTIP\s#474,\sfor\sreference:\s[https://sourceforge.net/p/tcl/mailman/message/36628988/]\r\n\r\nThe\sissue\sthat\sI\spredicted,\sand\sobserved\son\sAqua\swhen\strying\sthe\sTIP\s#474\simplementation,\swas\sthat\s&lt;4&gt;\sand\s&lt;5&gt;\swould\sbe\sconverted\sto\s&lt;MouseWheel&gt;,\sand\sno\slonger\sseen\sas\s&lt;4&gt;\sor\s&lt;5&gt;\sby\sthe\sprogram.\sEssentially,\sclicking\sthe\sextra\sbuttons\swould\sbecome\sequivalent\sto\srotating\sthe\sscrollwheel\sby\sone\sor\smore\snotches\son\snon-X11.\sI\sstrongly\ssuspected\sthis\sissue\salso\sapplied\sto\sWindows,\sbut\shad\snot\sconfirmed\sit;\sand\sI\swasn't\syet\saware\sthat\sI\swouldn't\sbe\sable\sto\sconfirm\sit,\sdue\sto\ssupport\sfor\sbuttons\s4\sand\s5\snot\seven\sbeing\simplemented\son\sWindows.\r\n\r\nHowever,\safter\sproperly\strying\sboth\smy\spatch\sand\sthe\sTIP\s#474\simplementation\ssimultaneously,\sI\s<b>don't</b>\sobserve\sthe\sissue\son\sWindows,\sas\sI\shad\son\sAqua;\sthe\sprogram\sstill\ssees\s&lt;4&gt;\sand\s&lt;5&gt;\sinstead\sof\s&lt;MouseWheel&gt;.\sI\sguess\sthe\sWindows\scode\snever\sgets\sto\sthe\spart\sof\s<code>UpdateButtonEventState()</code>\saffected\sby\sTIP\s#474.\sBut\sit's\sstill\sprobably\sclearer/safer\sto\smake\ssure\sthat\sany\s&lt;4&gt;\sor\s&lt;5&gt;\susage\sin\sgeneric\scode\schecks\sthat\sthe\swindowingsystem\sis\sX11\sif\sthose\sbuttons\sare\sbeing\sused\sfor\sscrolling.
J login chrstphrchvz
J mimetype text/x-fossil-wiki
J username chrstphrchvz
K 1fb7af623ac45badc115df0b3515a4e552400508
U chrstphrchvz
Z c18996b009605a7f246e148f010af92d