[xcb/proto] screensaver: Use CARD32 encoding for ScreenSaverSuspend 'suspend'

Submitted by Keith Packard on March 12, 2018, 7:03 p.m.

Details

Message ID 20180312190319.5910-1-keithp@keithp.com
State New
Headers show
Series "screensaver: Use CARD32 encoding for ScreenSaverSuspend 'suspend'" ( rev: 1 ) in X.org

Not browsing as part of any series.

Commit Message

Keith Packard March 12, 2018, 7:03 p.m.
This was set to BOOL, but the protocol headers used Bool, presumably a
32-bit type. We're switching everything to CARD32 as the best option
for compatibility.

Signed-off-by: Keith Packard <keithp@keithp.com>
---
 src/screensaver.xml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/screensaver.xml b/src/screensaver.xml
index 8d5abb4..c546f94 100644
--- a/src/screensaver.xml
+++ b/src/screensaver.xml
@@ -168,8 +168,7 @@  Draft Standard Version 1.1
   
   <!-- version 1.1 -->
   <request name="Suspend" opcode="5">
-    <field type="BOOL" name="suspend" />
-    <pad bytes="3" />
+    <field type="CARD32" name="suspend" />
   </request>
 
   <!-- Events -->

Comments

I think this belongs on xcb@.

Cheers,
Julien

On Mon, Mar 12, 2018 at 12:03:19 -0700, Keith Packard wrote:

> This was set to BOOL, but the protocol headers used Bool, presumably a
> 32-bit type. We're switching everything to CARD32 as the best option
> for compatibility.
> 
> Signed-off-by: Keith Packard <keithp@keithp.com>
> ---
>  src/screensaver.xml | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/src/screensaver.xml b/src/screensaver.xml
> index 8d5abb4..c546f94 100644
> --- a/src/screensaver.xml
> +++ b/src/screensaver.xml
> @@ -168,8 +168,7 @@ Draft Standard Version 1.1
>    
>    <!-- version 1.1 -->
>    <request name="Suspend" opcode="5">
> -    <field type="BOOL" name="suspend" />
> -    <pad bytes="3" />
> +    <field type="CARD32" name="suspend" />
>    </request>
>  
>    <!-- Events -->
> -- 
> 2.16.2
> 
> _______________________________________________
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel
Ah, that explains why Keith pushed a patch on 14th that was never on the
mailing list. (= This patch is already merged.)

Oh and while we are at it:
I cannot find the exact definition of the struct that the X server uses
for this, but it definitely only compares the "suspend" member of the
incoming request against "TRUE" and "FALSE". Presumably, these have
values 0 and 1. I see two problems with this:

a) SProcScreenSaverSuspend() only swaps the request length, not the boolean
b) What happens if I just send directly a value of 42?

For (b), it seems like the behaviour depends on whether the sending
client already suspended the screen saver before or not. In the first
case, 42 is interpreted as FALSE while in the second as TRUE.

Cheers,
Uli

On 20.03.2018 20:56, Julien Cristau wrote:
> I think this belongs on xcb@.
> 
> Cheers,
> Julien
> 
> On Mon, Mar 12, 2018 at 12:03:19 -0700, Keith Packard wrote:
> 
>> This was set to BOOL, but the protocol headers used Bool, presumably a
>> 32-bit type. We're switching everything to CARD32 as the best option
>> for compatibility.
>>
>> Signed-off-by: Keith Packard <keithp@keithp.com>
>> ---
>>  src/screensaver.xml | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/src/screensaver.xml b/src/screensaver.xml
>> index 8d5abb4..c546f94 100644
>> --- a/src/screensaver.xml
>> +++ b/src/screensaver.xml
>> @@ -168,8 +168,7 @@ Draft Standard Version 1.1
>>    
>>    <!-- version 1.1 -->
>>    <request name="Suspend" opcode="5">
>> -    <field type="BOOL" name="suspend" />
>> -    <pad bytes="3" />
>> +    <field type="CARD32" name="suspend" />
>>    </request>
>>  
>>    <!-- Events -->
>> -- 
>> 2.16.2
>>
>> _______________________________________________
>> xorg-devel@lists.x.org: X.Org development
>> Archives: http://lists.x.org/archives/xorg-devel
>> Info: https://lists.x.org/mailman/listinfo/xorg-devel
> _______________________________________________
> Xcb mailing list
> Xcb@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/xcb
>