Skip to content

Commit

Permalink
Merge pull request #23 from Totto16/fixes
Browse files Browse the repository at this point in the history
Port some types to GNOME 46 + some additional types
  • Loading branch information
JumpLink authored Mar 28, 2024
2 parents 16261f8 + ff64e4b commit 311b6f6
Show file tree
Hide file tree
Showing 5 changed files with 241 additions and 50 deletions.
11 changes: 11 additions & 0 deletions packages/gnome-shell/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,17 @@
}
},
"./ui/layout/ambient": "./dist/ui/layout-ambient.d.ts",
"./ui/lightbox": {
"import": {
"types": "./dist/ui/lightbox.d.ts",
"default": "./dist/ui/lightbox.js"
},
"require": {
"types": "./dist/ui/lightbox.d.ts",
"default": "./dist/ui/lightbox.cjs"
}
},
"./ui/lightbox/ambient": "./dist/ui/lightbox-ambient.d.ts",
"./ui/main": {
"import": {
"types": "./dist/ui/main.d.ts",
Expand Down
50 changes: 39 additions & 11 deletions packages/gnome-shell/src/ui/dialog.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ export interface ButtonInfo {
default?: boolean;
}

/**
* @version 46
*/
export class Dialog extends St.Widget {

protected _parentActor: St.Widget;
protected _dialog: St.BoxLayout;
protected _initialKeyFocus: St.Widget;
Expand All @@ -24,40 +26,66 @@ export class Dialog extends St.Widget {
public _init(parentActor: St.Widget, styleClass?: string | null): void;
public makeInactive(): void;
public vfunc_event(event: Clutter.Event): boolean;
public addButton(buttonInfo: ButtonInfo): void;
public addButton(buttonInfo: ButtonInfo): St.Button;
public clearButtons(): void;

protected _createDialog(): void;
protected _onDestroy(): void;
protected _setInitialKeyFocus(actor: St.Widget): void;
}

/**
* @version 46
*/
export namespace MessageDialogContent {
export interface ConstructorProperties extends St.BoxLayout.ConstructorProperties {
title?: string;
description?: string;
}
}
/**
* @version 46
*/
export class MessageDialogContent extends St.BoxLayout {
public title: string;
public description: string;

constructor(params: St.BoxLayout.ConstructorProperties);
public _init(params: St.BoxLayout.ConstructorProperties): void;
constructor(params: MessageDialogContent.ConstructorProperties);
public _init(params: MessageDialogContent.ConstructorProperties): void;

protected _onDestroy(): void;
protected _updateTitleStyle(): void;
protected _updateTitleStyle(): void | false;
}

export class ListSection extends St.BoxLayout {
export interface ListSectionProps extends St.BoxLayout.ConstructorProperties {
title?: string;
}

/**
* @version 46
*/
export class ListSection extends St.BoxLayout {
protected _listScrollView: St.ScrollView;
protected _title: St.Label;

public list: St.BoxLayout;
public title: string;
public label_actor: St.Label;

constructor(params: St.BoxLayout.ConstructorProperties);
public _init(params: St.BoxLayout.ConstructorProperties): void;
constructor(params: ListSectionProps);
public _init(params: ListSectionProps): void;
}

export class ListSectionItem extends St.BoxLayout {
export interface ListSectionItemProps extends St.BoxLayout.ConstructorProperties {
title?: string;
description?: string;
// note: iconActor hasn't: GObject.ParamFlags.CONSTRUCT, but might work anyways?
}

/**
* @version 46
*/
export class ListSectionItem extends St.BoxLayout {
protected _iconActorBin: St.Bin;
protected _title: St.Label;

Expand All @@ -67,6 +95,6 @@ export class ListSectionItem extends St.BoxLayout {

constructor(params: { style_class?: string | null });
/** @hidden Defined to resolve version conflicts */
public _init(config?: St.BoxLayout.ConstructorProperties): void;
public _init(config?: ListSectionItemProps): void;
public _init(params: { style_class?: string | null }): void;
}
}
94 changes: 70 additions & 24 deletions packages/gnome-shell/src/ui/layout.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,22 @@ export interface Geometry {
width: number;
height: number;
}
/**
* @version 46
*/

export class MonitorConstraint extends Clutter.Constraint {
export namespace MonitorConstraint {
export interface ConstructorProperties extends Clutter.Constraint.ConstructorProperties {
primary?: boolean;
index?: number;
workArea?: boolean;
}
}

/**
* @version 46
*/
export class MonitorConstraint extends Clutter.Constraint {
protected _primary: boolean;
protected _index: number;
protected _workArea: boolean;
Expand All @@ -31,14 +44,17 @@ export class MonitorConstraint extends Clutter.Constraint {
public index: number;
public workArea: boolean;

constructor(props: Clutter.Constraint.ConstructorProperties);
public _init(props: Clutter.Constraint.ConstructorProperties): void;
constructor(props: MonitorConstraint.ConstructorProperties);
public _init(props: MonitorConstraint.ConstructorProperties): void;

public vfunc_set_actor(actor: Clutter.Actor): void;
public vfunc_update_allocation(actor: Clutter.Actor, actorBox: Clutter.ActorBox): void;
}

/**
* @version 46
*/
declare class Monitor {

public index: number;
public geometryScale: number;
public x: number;
Expand All @@ -50,6 +66,9 @@ declare class Monitor {
constructor(index: number, geometry: Geometry, geometryScale: number);
}

/**
* @version 46
*/
declare class UiActor extends St.Widget {
public constructor(props?: St.Widget.ConstructorProperties);
public _init(props?: St.Widget.ConstructorProperties): void;
Expand All @@ -73,7 +92,6 @@ declare class ScreenTransition extends Clutter.Actor {
* overview.
*/
declare class HotCorner extends Clutter.Actor {

protected _entered: boolean;
protected _monitor: Monitor;
protected _x: number;
Expand All @@ -97,13 +115,16 @@ declare class HotCorner extends Clutter.Actor {
}

export class LayoutManager extends GObject.Object {

protected _rtl: boolean;
protected _keyboardIndex: number;
protected _rightPanelBarrier: Meta.Barrier | null;
protected _inOverview: boolean;
protected _updateRegionIdle: number;
protected _trackedActors: { trackFullscreen: boolean; affectsStruts: boolean; affectsInputRegion: boolean; }[];
protected _trackedActors: {
trackFullscreen: boolean;
affectsStruts: boolean;
affectsInputRegion: boolean;
}[];
protected _keyboardHeightNotifyId: number;
protected _backgroundGroup: Meta.BackgroundGroup;
protected _interfaceSettings: Gio.Settings;
Expand Down Expand Up @@ -148,12 +169,12 @@ export class LayoutManager extends GObject.Object {
* function before you show the menu to ensure it is at the right
* position and has the right size.
* @param x
* @param y
* @param width
* @param height
* @param y
* @param width
* @param height
*/
public setDummyCursorGeometry(x: number, y: number, width: number, height: number): void;

/**
* Adds `actor` to the chrome, and (unless `affectsInputRegion` in
* `params` is `false`) extends the input region to include it.
Expand All @@ -173,27 +194,48 @@ export class LayoutManager extends GObject.Object {
* @param actor An actor to add to the chrome
* @param params Additional params
*/
public addChrome(actor: Clutter.Actor, params?: { affectsStruts?: boolean; affectsInputRegion?: boolean; trackFullscreen?: boolean; }): void;
public addChrome(
actor: Clutter.Actor,
params?: {
affectsStruts?: boolean;
affectsInputRegion?: boolean;
trackFullscreen?: boolean;
}
): void;

/**
* Like {@link addChrome()}, but adds `actor` above all windows, including popups.
* @param actor An actor to add to the chrome
* @param params Additional params
*/
public addTopChrome(actor: Clutter.Actor, params?: { affectsStruts?: boolean; affectsInputRegion?: boolean; trackFullscreen?: boolean; }): void;

public addTopChrome(
actor: Clutter.Actor,
params?: {
affectsStruts?: boolean;
affectsInputRegion?: boolean;
trackFullscreen?: boolean;
}
): void;

/**
* Tells the chrome to track `actor`. This can be used to extend the
* struts or input region to cover specific children.
*
*
* `params` can have any of the same values as in {@link addChrome()},
* though some possibilities don't make sense. By default, `actor` has
* the same params as its chrome ancestor.
*
*
* @param actor a descendant of the chrome to begin tracking
* @param params parameters describing how to track `actor`
*/
public trackChrome(actor: Clutter.Actor, params?: { affectsStruts?: boolean; affectsInputRegion?: boolean; trackFullscreen?: boolean; }): void;
public trackChrome(
actor: Clutter.Actor,
params?: {
affectsStruts?: boolean;
affectsInputRegion?: boolean;
trackFullscreen?: boolean;
}
): void;

/**
* Undoes the effect of {@link trackChrome()}
Expand All @@ -213,15 +255,14 @@ export class LayoutManager extends GObject.Object {
/**
* This call guarantees that we return some monitor to simplify usage of it
* In practice all tracked actors should be visible on some monitor anyway
* @param actor
* @param actor
*/
public findIndexForActor(actor: Clutter.Actor): number
public findIndexForActor(actor: Clutter.Actor): number;

public findMonitorForActor(actor: Clutter.Actor): Monitor | undefined
public findMonitorForActor(actor: Clutter.Actor): Monitor | undefined;

public modalEnded(): void;


protected _sessionUpdated(): void;
protected _updateMonitors(): void;
protected _updateHotCorners(): void;
Expand Down Expand Up @@ -259,7 +300,14 @@ export class LayoutManager extends GObject.Object {
protected _startupAnimationSession(): void;
protected _startupAnimationComplete(): void;
protected _findActor(actor: Clutter.Actor): number;
protected _trackActor(actor: Clutter.Actor, params?: { affectsStruts?: boolean; affectsInputRegion?: boolean; trackFullscreen?: boolean; }): void;
protected _trackActor(
actor: Clutter.Actor,
params?: {
affectsStruts?: boolean;
affectsInputRegion?: boolean;
trackFullscreen?: boolean;
}
): void;
protected _untrackActor(actor: Clutter.Actor): void;
protected _updateActorVisibility(actorData: any): void;
protected _updateVisibility(): void;
Expand All @@ -270,7 +318,6 @@ export class LayoutManager extends GObject.Object {
}

declare class PressureBarrier extends EventEmitter {

protected _threshold: number;
protected _timeout: number;
protected _actionMode: number;
Expand Down Expand Up @@ -298,4 +345,3 @@ declare class PressureBarrier extends EventEmitter {
protected _trigger(): void;
protected _onBarrierHit(barrier: Meta.Barrier, event: any): void;
}

Loading

0 comments on commit 311b6f6

Please sign in to comment.