1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## 52_scim-1.4.7-imdkit-read-property-properly.dpatch by Ikuya Awashiro <ikuya@fruitsbasket.info>
4 ## All lines beginning with `## DP:' are a description of the patch.
5 ## DP: Correctly read XIM_FORWARD_EVENT, triggered when rapidly typing keys
6 ## DP: https://bugzilla.redhat.com/show_bug.cgi?id=466657
9 diff -urNad scim-1.4
.9~
/modules
/FrontEnd
/IMdkit
/Xi18n.h scim-1.4
.9/modules
/FrontEnd
/IMdkit
/Xi18n.h
10 --- scim-1.4
.9~
/modules
/FrontEnd
/IMdkit
/Xi18n.h
2008-11-02 06:42:13.000000000 +0000
11 +++ scim-1.4
.9/modules
/FrontEnd
/IMdkit
/Xi18n.h
2009-07-20 11:48:01.000000000 +0000
16 + /* property offset to
read next data
*/
17 + long property_offset
;
18 void
*trans_rec
; /* contains transport specific data
*/
19 struct _Xi18nClient
*next
;
21 diff -urNad scim-1.4
.9~
/modules
/FrontEnd
/IMdkit
/i18nUtil.c scim-1.4
.9/modules
/FrontEnd
/IMdkit
/i18nUtil.c
22 --- scim-1.4
.9~
/modules
/FrontEnd
/IMdkit
/i18nUtil.c
2008-11-02 06:42:13.000000000 +0000
23 +++ scim-1.4
.9/modules
/FrontEnd
/IMdkit
/i18nUtil.c
2009-07-20 11:48:01.000000000 +0000
26 client-
>byte_order
= '?'; /* initial value
*/
27 memset
(&client-
>pending
, 0, sizeof
(XIMPending
*));
28 + client-
>property_offset
= 0;
29 client-
>next
= i18n_core-
>address.clients
;
30 i18n_core-
>address.clients
= client
;
32 diff -urNad scim-1.4
.9~
/modules
/FrontEnd
/IMdkit
/i18nX.c scim-1.4
.9/modules
/FrontEnd
/IMdkit
/i18nX.c
33 --- scim-1.4
.9~
/modules
/FrontEnd
/IMdkit
/i18nX.c
2008-11-02 06:42:12.000000000 +0000
34 +++ scim-1.4
.9/modules
/FrontEnd
/IMdkit
/i18nX.c
2009-07-20 11:48:01.000000000 +0000
37 ******************************************************************/
41 #include <X11/Xatom.h>
44 else if (ev-
>format
== 32) {
45 /* ClientMessage and WindowProperty
*/
46 unsigned long length
= (unsigned long
) ev-
>data.l
[0];
47 + unsigned long get_length
;
48 Atom atom
= (Atom
) ev-
>data.l
[1];
55 + /* Round up length to next
4 byte value.
*/
56 + get_length
= length
+ 3;
57 + if (get_length
> LONG_MAX
)
58 + get_length
= LONG_MAX
;
60 + if (get_length
== 0) {
61 + fprintf
(stderr
, "%s: invalid length 0\n", __FUNCTION__
);
64 return_code
= XGetWindowProperty
(i18n_core-
>address.dpy
,
69 + client-
>property_offset
/ 4,
75 if (return_code
!= Success || actual_format_ret
== 0 || nitems
== 0) {
76 if (return_code
== Success
)
78 + client-
>property_offset
= 0;
79 return (unsigned char
*) NULL
;
81 - if (length
!= nitems
)
83 - if (actual_format_ret
== 16)
85 - else if (actual_format_ret
== 32)
88 + /* Update the offset to
read next
time as needed
*/
89 + if (bytes_after_ret
> 0)
90 + client-
>property_offset
+= length
;
92 + client-
>property_offset
= 0;
93 + switch
(actual_format_ret
) {
97 + length
= nitems
* actual_format_ret
/ 8;
100 + fprintf
(stderr
, "%s: unknown property return format: %d\n",
101 + __FUNCTION__
, actual_format_ret
);
103 + client-
>property_offset
= 0;
106 /* if hit
, it might be an error
*/
107 if ((p
= (unsigned char
*) malloc
(length
)) == NULL
)
108 return (unsigned char
*) NULL
;