[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41147] trunk/blender/source/blender: fixes for unicode input, should work for operator textinput now.

Campbell Barton ideasman42 at gmail.com
Sat Oct 22 04:12:18 CEST 2011


Checked on windows and linux before any of these utf8 changes,
on key-up both systems have 'event->ascii' unset, so I think having
utf8 unset on keyup is correct.

With backspace I'm not sure whats going on, it works ok for me on linux.

To help debug these issues I've added a WM_event_print() function,
see wm_event_system.c:2734, uncomment the call to WM_event_print() and
youll see what events the window manager is getting.

On Sat, Oct 22, 2011 at 5:34 AM, Dalai Felinto <dfelinto at gmail.com> wrote:
> Now that windows has utf8 support, the problem can be reproduced there as
> well.
> While editing a Font Object:
>
> problem 1: backspace is not working well
> problem 2: new letters are added at KeyDown and KeyUp
>
> --
> Dalai
>
> 2011/10/20 Campbell Barton <ideasman42 at gmail.com>
>
>> For now I think we should keep both.
>>
>> On Fri, Oct 21, 2011 at 10:44 AM, Dalai Felinto <dfelinto at gmail.com>
>> wrote:
>> > It's indeed this commit (#41147). Jens confirmed there as well.
>> > My suspicions lies on the fact that in OSX when we have utf8 we have no
>> > ascii.
>> >
>> > --
>> > Dalai
>> >
>> > 2011/10/20 Campbell Barton <ideasman42 at gmail.com>
>> >
>> >> Hi Dalai, I can't redo this bug.
>> >>
>> >> On Fri, Oct 21, 2011 at 5:33 AM, Dalai Felinto <dfelinto at gmail.com>
>> wrote:
>> >> > Hi Campbell,
>> >> >
>> >> > One of those recent commits broke backspace in Font objects.
>> >> > To test it: (1) add a new Font object (2) remove the text.-- it
>> removes
>> >> the
>> >> > 1st letter, but to go further you need to keep backspace pressed.
>> (pure
>> >> > English, no utf8 text input).
>> >> >
>> >> > confirmed on osx only, not sure about lin + win.
>> >> > --
>> >> > Dalai
>> >> >
>> >> >
>> >> > 2011/10/20 Campbell Barton <ideasman42 at gmail.com>
>> >> >
>> >> >> Revision: 41147
>> >> >>
>> >> >>
>> >>
>> http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41147
>> >> >> Author:   campbellbarton
>> >> >> Date:     2011-10-20 11:18:57 +0000 (Thu, 20 Oct 2011)
>> >> >> Log Message:
>> >> >> -----------
>> >> >> fixes for unicode input, should work for operator textinput now.
>> >> >>
>> >> >> Modified Paths:
>> >> >> --------------
>> >> >>    trunk/blender/source/blender/editors/curve/editfont.c
>> >> >>
>>  trunk/blender/source/blender/editors/interface/interface_handlers.c
>> >> >>
>>  trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
>> >> >>
>> >> >> Modified: trunk/blender/source/blender/editors/curve/editfont.c
>> >> >> ===================================================================
>> >> >> --- trunk/blender/source/blender/editors/curve/editfont.c
>> >> 2011-10-20
>> >> >> 10:47:38 UTC (rev 41146)
>> >> >> +++ trunk/blender/source/blender/editors/curve/editfont.c
>> >> 2011-10-20
>> >> >> 11:18:57 UTC (rev 41147)
>> >> >> @@ -1289,7 +1289,7 @@
>> >> >>        else if(event==BACKSPACEKEY)
>> >> >>                ascii= 0;
>> >> >>
>> >> >> -       if(val && ascii) {
>> >> >> +       if(val && (ascii || evt->utf8_buf[0])) {
>> >> >>                /* handle case like TAB (== 9) */
>> >> >>                if(     (ascii > 31 && ascii < 254 && ascii != 127) ||
>> >> >>                        (ascii==13) ||
>> >> >>
>> >> >> Modified:
>> >> >> trunk/blender/source/blender/editors/interface/interface_handlers.c
>> >> >> ===================================================================
>> >> >> ---
>> trunk/blender/source/blender/editors/interface/interface_handlers.c
>> >> >> 2011-10-20 10:47:38 UTC (rev 41146)
>> >> >> +++
>> trunk/blender/source/blender/editors/interface/interface_handlers.c
>> >> >> 2011-10-20 11:18:57 UTC (rev 41147)
>> >> >> @@ -1930,7 +1930,7 @@
>> >> >>                                break;
>> >> >>                }
>> >> >>
>> >> >> -               if(event->ascii && (retval ==
>> WM_UI_HANDLER_CONTINUE)) {
>> >> >> +               if((event->ascii || event->utf8_buf[0]) && (retval ==
>> >> >> WM_UI_HANDLER_CONTINUE)) {
>> >> >>                        char ascii = event->ascii;
>> >> >>
>> >> >>                        /* exception that's useful for number buttons,
>> >> some
>> >> >> keyboard
>> >> >> @@ -1939,7 +1939,7 @@
>> >> >>                                if(event->type == PADPERIOD && ascii
>> ==
>> >> ',')
>> >> >>                                        ascii = '.';
>> >> >>
>> >> >> -                       if(event->utf8_buf[0] || 1) {
>> >> >> +                       if(event->utf8_buf[0]) {
>> >> >>                                /* keep this printf until utf8 is well
>> >> >> tested */
>> >> >>                                printf("%s: utf8 char '%s'\n",
>> __func__,
>> >> >> event->utf8_buf);
>> >> >>                                // strcpy(event->utf8_buf, "12345");
>> >> >>
>> >> >> Modified:
>> >> >> trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
>> >> >> ===================================================================
>> >> >> ---
>> trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
>> >> >> 2011-10-20 10:47:38 UTC (rev 41146)
>> >> >> +++
>> trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
>> >> >> 2011-10-20 11:18:57 UTC (rev 41147)
>> >> >> @@ -1146,7 +1146,7 @@
>> >> >>
>> >> >>        /* the matching rules */
>> >> >>        if(kmitype==KM_TEXTINPUT)
>> >> >> -               if(ISTEXTINPUT(winevent->type) && winevent->ascii)
>> >> return
>> >> >> 1;
>> >> >> +               if(ISTEXTINPUT(winevent->type) && (winevent->ascii ||
>> >> >> winevent->utf8_buf[0])) return 1;
>> >> >>        if(kmitype!=KM_ANY)
>> >> >>                if(winevent->type!=kmitype) return 0;
>> >> >>
>> >> >>
>> >> >> _______________________________________________
>> >> >> Bf-blender-cvs mailing list
>> >> >> Bf-blender-cvs at blender.org
>> >> >> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>> >> >>
>> >> > _______________________________________________
>> >> > Bf-committers mailing list
>> >> > Bf-committers at blender.org
>> >> > http://lists.blender.org/mailman/listinfo/bf-committers
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> - Campbell
>> >> _______________________________________________
>> >> Bf-committers mailing list
>> >> Bf-committers at blender.org
>> >> http://lists.blender.org/mailman/listinfo/bf-committers
>> >>
>> > _______________________________________________
>> > Bf-committers mailing list
>> > Bf-committers at blender.org
>> > http://lists.blender.org/mailman/listinfo/bf-committers
>> >
>>
>>
>>
>> --
>> - Campbell
>> _______________________________________________
>> Bf-committers mailing list
>> Bf-committers at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-committers
>>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>



-- 
- Campbell


More information about the Bf-committers mailing list