Skip to content

shape_combine definition is invalid - TypeError: Missing required argument destination_window #262

Open
@acidkewpie

Description

@acidkewpie

I thought I was missing something, but it's looking like no one has EVER used shape_combine, but the definition of the function does not attempt to create the object with the required destination_window parameter:

class Combine(rq.Request):

    _request = rq.Struct(
        rq.Card8('opcode'),
        rq.Opcode(3),
        rq.RequestLength(),
        OP('operation'),
        KIND('destination_kind'),
        KIND('source_kind'),
        rq.Pad(1),
        rq.Window('destination_window'),
        rq.Int16('x_offset'),
        rq.Int16('y_offset'),
        rq.Window('source_window'),
    )
[...]
def combine(self, operation, destination_kind, source_kind, x_offset, y_offset):
    Combine(
        display=self.display,
        opcode=self.display.get_extension_major(extname),
        source_window=self,
        operation=operation,
        destination_kind=destination_kind,
        source_kind=source_kind,
        x_offset=x_offset,
        y_offset=y_offset,
    )

shape_mask is, in believe, only different from shape_combine in that it takes in a window of varying colour depth, instead of a binary bitmap. As such the parameters should be identical except the source_bitmap parameter in shape_mask should instead be the source_kind option (present) and source_window (missing!) in shape_combine. mask is defined as:

def mask(self, operation, destination_kind, x_offset, y_offset, source_bitmap):
    Mask(
        display=self.display,
        opcode=self.display.get_extension_major(extname),
        destination_window=self,
        operation=operation,
        destination_kind=destination_kind,
        x_offset=x_offset,
        y_offset=y_offset,
        source_bitmap=source_bitmap,
    )

so combine should actually be defined as:

def combine(self, operation, destination_kind, source_kind, x_offset, y_offset):
    Combine(
        display=self.display,
        opcode=self.display.get_extension_major(extname),
        source_window=source_window
        destination_window=self,
        operation=operation,
        destination_kind=destination_kind,
        source_kind=source_kind,
        x_offset=x_offset,
        y_offset=y_offset,
        source_window=source_window
    )

Indeed it seems that parameters for source and destination windows have in fact been... wait for it... combined!

#263

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions