Skip to content

Commit

Permalink
Make named args for X11Rectangle
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-ancell committed Nov 28, 2023
1 parent 5e3a3eb commit 25c9ed6
Show file tree
Hide file tree
Showing 17 changed files with 114 additions and 78 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var client = X11Client();
await client.connect();
var id = client.generateId();
client.createWindow(id, client.screens[0].window, X11Rectangle(0, 0, 400, 300));
client.createWindow(id, client.screens[0].window, X11Rectangle(width: 400, height: 300));
await client.changePropertyString(id, 'WM_NAME', 'x11.dart');
client.mapWindow(id);
Expand Down
2 changes: 1 addition & 1 deletion example/dart-logo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void main() async {

var id = client.generateId();
client.createWindow(
id, client.screens[0].window, X11Rectangle(0, 0, 400, 300),
id, client.screens[0].window, X11Rectangle(width: 400, height: 300),
events: {X11EventType.exposure}, backgroundPixel: 0x00000000);
await client.changePropertyString(id, 'WM_NAME', 'x11.dart');
client.mapWindow(id);
Expand Down
2 changes: 1 addition & 1 deletion example/example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ void main() async {

var id = client.generateId();
client.createWindow(
id, client.screens[0].window, X11Rectangle(0, 0, 400, 300));
id, client.screens[0].window, X11Rectangle(width: 400, height: 300));
await client.changePropertyString(id, 'WM_NAME', 'x11.dart');
client.mapWindow(id);

Expand Down
2 changes: 1 addition & 1 deletion example/font.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void main() async {
});

client.createWindow(
window, client.screens[0].window, X11Rectangle(0, 0, 400, 300),
window, client.screens[0].window, X11Rectangle(width: 400, height: 300),
events: {X11EventType.exposure}, backgroundPixel: 0x00000000);
client.openFont(font, '*');
client.createGC(gc, window, font: font);
Expand Down
2 changes: 1 addition & 1 deletion example/window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void main() async {

var id = client.generateId();
client.createWindow(
id, client.screens[0].window, X11Rectangle(0, 0, 400, 300),
id, client.screens[0].window, X11Rectangle(width: 400, height: 300),
events: {
X11EventType.keyPress,
X11EventType.keyRelease,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/x11_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ class X11Client {
int warpPointer(X11Point destination,
{X11ResourceId destinationWindow = X11ResourceId.None,
X11ResourceId sourceWindow = X11ResourceId.None,
X11Rectangle source = const X11Rectangle(0, 0, 0, 0)}) {
X11Rectangle source = const X11Rectangle()}) {
var request = X11WarpPointerRequest(destination,
destinationWindow: destinationWindow,
sourceWindow: sourceWindow,
Expand Down
10 changes: 7 additions & 3 deletions lib/src/x11_damage_events.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ class X11DamageNotifyEvent extends X11Event {
var geometryHeight = buffer.readUint16();
return X11DamageNotifyEvent(firstEventCode, drawable, damage,
level: level,
area: X11Rectangle(areaX, areaY, areaWidth, areaHeight),
geometry:
X11Rectangle(geometryX, geometryY, geometryWidth, geometryHeight),
area: X11Rectangle(
x: areaX, y: areaY, width: areaWidth, height: areaHeight),
geometry: X11Rectangle(
x: geometryX,
y: geometryY,
width: geometryWidth,
height: geometryHeight),
timestamp: timestamp);
}

Expand Down
24 changes: 17 additions & 7 deletions lib/src/x11_events.dart
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,8 @@ class X11ExposeEvent extends X11Event {
var height = buffer.readUint16();
var count = buffer.readUint16();
buffer.skip(2);
return X11ExposeEvent(window, X11Rectangle(x, y, width, height),
return X11ExposeEvent(
window, X11Rectangle(x: x, y: y, width: width, height: height),
count: count);
}

Expand Down Expand Up @@ -542,7 +543,10 @@ class X11GraphicsExposureEvent extends X11Event {
var majorOpcode = buffer.readUint8();
buffer.skip(3);
return X11GraphicsExposureEvent(
drawable, X11Rectangle(x, y, width, height), majorOpcode, minorOpcode,
drawable,
X11Rectangle(x: x, y: y, width: width, height: height),
majorOpcode,
minorOpcode,
count: count);
}

Expand Down Expand Up @@ -635,7 +639,7 @@ class X11CreateNotifyEvent extends X11Event {
var overrideRedirect = buffer.readBool();
buffer.skip(1);
return X11CreateNotifyEvent(
window, parent, X11Rectangle(x, y, width, height),
window, parent, X11Rectangle(x: x, y: y, width: width, height: height),
borderWidth: borderWidth, overrideRedirect: overrideRedirect);
}

Expand Down Expand Up @@ -827,7 +831,8 @@ class X11ConfigureNotifyEvent extends X11Event {
var borderWidth = buffer.readUint16();
var overrideRedirect = buffer.readBool();
buffer.skip(1);
return X11ConfigureNotifyEvent(window, X11Rectangle(x, y, width, height),
return X11ConfigureNotifyEvent(
window, X11Rectangle(x: x, y: y, width: width, height: height),
event: event,
aboveSibling: aboveSibling,
borderWidth: borderWidth,
Expand Down Expand Up @@ -878,7 +883,8 @@ class X11ConfigureRequestEvent extends X11Event {
var height = buffer.readUint16();
var borderWidth = buffer.readUint16();
var valueMask = buffer.readUint16();
return X11ConfigureRequestEvent(window, X11Rectangle(x, y, width, height),
return X11ConfigureRequestEvent(
window, X11Rectangle(x: x, y: y, width: width, height: height),
stackMode: stackMode,
parent: parent,
sibling: sibling,
Expand Down Expand Up @@ -1280,7 +1286,7 @@ class X11ShapeNotifyEvent extends X11Event {
X11ShapeNotifyEvent(this.firstEventCode,
{this.shapeKind = X11ShapeKind.bounding,
this.affectedWindow = X11ResourceId.None,
this.extents = const X11Rectangle(0, 0, 0, 0),
this.extents = const X11Rectangle(),
this.serverTime = 0,
this.shaped = false});

Expand All @@ -1298,7 +1304,11 @@ class X11ShapeNotifyEvent extends X11Event {
return X11ShapeNotifyEvent(firstEventCode,
shapeKind: shapeKind,
affectedWindow: affectedWindow,
extents: X11Rectangle(extentsX, extentsY, extentsWidth, extentsHeight),
extents: X11Rectangle(
x: extentsX,
y: extentsY,
width: extentsWidth,
height: extentsHeight),
serverTime: serverTime,
shaped: shaped);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/x11_mit_screen_saver_requests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ class X11ScreensaverSetAttributesRequest extends X11Request {
cursor = buffer.readResourceId();
}
return X11ScreensaverSetAttributesRequest(
drawable, X11Rectangle(x, y, width, height),
drawable, X11Rectangle(x: x, y: y, width: width, height: height),
borderWidth: borderWidth,
windowClass: windowClass,
depth: depth,
Expand Down
6 changes: 3 additions & 3 deletions lib/src/x11_mit_shm_requests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class X11MitShmPutImageRequest extends X11Request {
drawable,
shmseg,
X11Size(totalWidth, totalHeight),
X11Rectangle(srcX, srcY, srcWidth, srcHeight),
X11Rectangle(x: srcX, y: srcY, width: srcWidth, height: srcHeight),
X11Point(dstX, dstY),
depth: depth,
format: format,
Expand Down Expand Up @@ -213,8 +213,8 @@ class X11MitShmGetImageRequest extends X11Request {
buffer.skip(3);
var shmseg = buffer.readUint32();
var offset = buffer.readUint32();
return X11MitShmGetImageRequest(
drawable, X11Rectangle(x, y, width, height), shmseg,
return X11MitShmGetImageRequest(drawable,
X11Rectangle(x: x, y: y, width: width, height: height), shmseg,
planeMask: planeMask, format: format, offset: offset);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/src/x11_randr_events.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class X11RandrCrtcChangeNotifyEvent extends X11Event {
this.crtc = X11ResourceId.None,
this.mode = X11ResourceId.None,
this.rotation = const {X11RandrRotation.rotate0},
this.area = const X11Rectangle(0, 0, 0, 0),
this.area = const X11Rectangle(),
this.timestamp = 0});

factory X11RandrCrtcChangeNotifyEvent.fromBuffer(
Expand All @@ -124,7 +124,7 @@ class X11RandrCrtcChangeNotifyEvent extends X11Event {
crtc: crtc,
mode: mode,
rotation: rotation,
area: X11Rectangle(x, y, width, height),
area: X11Rectangle(x: x, y: y, width: width, height: height),
timestamp: timestamp);
}

Expand Down
22 changes: 12 additions & 10 deletions lib/src/x11_randr_requests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ class X11RandrGetCrtcInfoReply extends X11Reply {
X11RandrGetCrtcInfoReply(
{this.status = X11RandrConfigStatus.success,
this.timestamp = 0,
this.area = const X11Rectangle(0, 0, 0, 0),
this.area = const X11Rectangle(),
this.mode = X11ResourceId.None,
this.rotation = 0,
this.rotations = 0,
Expand All @@ -1294,7 +1294,7 @@ class X11RandrGetCrtcInfoReply extends X11Reply {
return X11RandrGetCrtcInfoReply(
status: status,
timestamp: timestamp,
area: X11Rectangle(x, y, width, height),
area: X11Rectangle(x: x, y: y, width: width, height: height),
mode: mode,
rotation: rotation,
rotations: rotations,
Expand Down Expand Up @@ -1881,8 +1881,8 @@ class X11RandrGetPanningReply extends X11Reply {

X11RandrGetPanningReply(
{required this.status,
this.area = const X11Rectangle(0, 0, 0, 0),
this.trackArea = const X11Rectangle(0, 0, 0, 0),
this.area = const X11Rectangle(),
this.trackArea = const X11Rectangle(),
required this.borderLeft,
required this.borderTop,
required this.borderRight,
Expand All @@ -1906,8 +1906,9 @@ class X11RandrGetPanningReply extends X11Reply {
var borderBottom = buffer.readInt16();
return X11RandrGetPanningReply(
status: status,
area: X11Rectangle(left, top, width, height),
trackArea: X11Rectangle(trackLeft, trackTop, trackWidth, trackHeight),
area: X11Rectangle(x: left, y: top, width: width, height: height),
trackArea: X11Rectangle(
x: trackLeft, y: trackTop, width: trackWidth, height: trackHeight),
borderLeft: borderLeft,
borderTop: borderTop,
borderRight: borderRight,
Expand Down Expand Up @@ -1949,8 +1950,8 @@ class X11RandrSetPanningRequest extends X11Request {
final int timestamp;

X11RandrSetPanningRequest(this.crtc,
{this.area = const X11Rectangle(0, 0, 0, 0),
this.trackArea = const X11Rectangle(0, 0, 0, 0),
{this.area = const X11Rectangle(),
this.trackArea = const X11Rectangle(),
this.borderLeft = 0,
this.borderTop = 0,
this.borderRight = 0,
Expand All @@ -1973,8 +1974,9 @@ class X11RandrSetPanningRequest extends X11Request {
var borderRight = buffer.readInt16();
var borderBottom = buffer.readInt16();
return X11RandrSetPanningRequest(crtc,
area: X11Rectangle(left, top, width, height),
trackArea: X11Rectangle(trackLeft, trackTop, trackWidth, trackHeight),
area: X11Rectangle(x: left, y: top, width: width, height: height),
trackArea: X11Rectangle(
x: trackLeft, y: trackTop, width: trackWidth, height: trackHeight),
borderLeft: borderLeft,
borderTop: borderTop,
borderRight: borderRight,
Expand Down
7 changes: 4 additions & 3 deletions lib/src/x11_render_requests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ class X11RenderSetPictureClipRectanglesRequest extends X11Request {
var y = buffer.readInt16();
var width = buffer.readUint16();
var height = buffer.readUint16();
rectangles.add(X11Rectangle(x, y, width, height));
rectangles.add(X11Rectangle(x: x, y: y, width: width, height: height));
}
return X11RenderSetPictureClipRectanglesRequest(picture, rectangles,
clipOrigin: X11Point(clipXOrigin, clipYOrigin));
Expand Down Expand Up @@ -1226,7 +1226,8 @@ class X11RenderAddGlyphsRequest extends X11Request {
var y = buffer.readInt16();
var dx = buffer.readInt16();
var dy = buffer.readInt16();
glyphs.add(X11GlyphInfo(ids[i], X11Rectangle(x, y, width, height),
glyphs.add(X11GlyphInfo(
ids[i], X11Rectangle(x: x, y: y, width: width, height: height),
offset: X11Point(dx, dy)));
}
var data = buffer.readListOfUint8(buffer.remaining);
Expand Down Expand Up @@ -1576,7 +1577,7 @@ class X11RenderFillRectanglesRequest extends X11Request {
var y = buffer.readInt16();
var width = buffer.readUint16();
var height = buffer.readUint16();
rectangles.add(X11Rectangle(x, y, width, height));
rectangles.add(X11Rectangle(x: x, y: y, width: width, height: height));
}
return X11RenderFillRectanglesRequest(destinationPicture, rectangles,
op: op, color: X11Rgba(red, green, blue, alpha));
Expand Down
Loading

0 comments on commit 25c9ed6

Please sign in to comment.