Skip to content

Commit

Permalink
Really revert second screen
Browse files Browse the repository at this point in the history
This reverts commit 2f954a8.
  • Loading branch information
antonk777 committed Jan 10, 2022
1 parent a371478 commit 5413e0f
Show file tree
Hide file tree
Showing 20 changed files with 141 additions and 805 deletions.
1 change: 0 additions & 1 deletion native/css/general.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

body {
font-family: "Roboto", sans-serif;
user-select: none;
}

h1,
Expand Down
8 changes: 1 addition & 7 deletions native/css/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,15 @@
.app-header h1 {
padding-left: 8px;
margin: 0;
color: #8d8d8d;
font-style: normal;
font-weight: normal;
color: #8d8d8d;
font-size: 14px;
cursor: inherit;
}

.app-header .hotkey-text {
margin: 0 auto;
padding-left: 8px;
color: #8d8d8d;
font-style: normal;
font-weight: normal;
font-size: 14px;
cursor: inherit;
}

.app-header .hotkey-text kbd {
Expand Down
1 change: 0 additions & 1 deletion native/css/ingame.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ h1 {
flex-direction: column;
flex: 1 1 50%;
padding-right: 30px;
user-select: auto;
}

#ad {
Expand Down
41 changes: 8 additions & 33 deletions native/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"meta": {
"name": "Sample App",
"author": "Overwolf",
"version": "2.0.3",
"minimum-overwolf-version": "0.170.0",
"version": "2.0.2",
"minimum-overwolf-version": "0.160.0",
"description": "An example app for developers new to Overwolf",
"icon": "icons/IconMouseOver.png",
"icon_gray": "icons/IconMouseNormal.png",
Expand All @@ -15,8 +15,7 @@
"permissions": [
"Hotkeys",
"GameInfo",
"Clipboard",
"DesktopStreaming"
"Clipboard"
],
"data": {
"start_window": "background",
Expand All @@ -25,11 +24,6 @@
"title": "Show/Hide In-Game Window",
"action-type": "toggle",
"default": "Ctrl+F"
},
"sample_app_second_screen": {
"title": "Toggle Second Screen Window",
"action-type": "custom",
"default": "Ctrl+G"
}
},
"protocol_override_domains": {
Expand All @@ -56,7 +50,7 @@
"desktop_only": true,
"native_window": true,
"resizable": true,
"transparent": false,
"transparent": true,
"override_on_update": true,
"size": {
"width": 1212,
Expand All @@ -65,6 +59,10 @@
"min_size": {
"width": 1212,
"height": 699
},
"max_size": {
"width": 2500,
"height": 1400
}
},
"in_game": {
Expand All @@ -78,29 +76,6 @@
"size": {
"width": 1212,
"height": 699
},
"min_size": {
"width": 1212,
"height": 699
}
},
"second": {
"file": "windows/second/second.html",
"desktop_only": true,
"native_window": true,
"resizable": false,
"transparent": false,
"override_on_update": true,
"keep_window_location": true,
"disable_hardware_acceleration": true,
"topmost": true,
"size": {
"width": 1212,
"height": 699
},
"min_size": {
"width": 1212,
"height": 699
}
}
},
Expand Down
1 change: 0 additions & 1 deletion native/scripts/constants/hotkeys-ids.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export const kHotkeyToggle = 'sample_app_showhide';
export const kHotkeySecondScreen = 'sample_app_second_screen';
1 change: 0 additions & 1 deletion native/scripts/constants/window-names.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export const kWindowNames = {
BACKGROUND: 'background',
DESKTOP: 'desktop',
SECOND: 'second',
IN_GAME: 'in_game'
};
8 changes: 0 additions & 8 deletions native/scripts/services/event-bus.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ export class EventBus {
this._listeners.push(eventHandler);
}

removeListener(eventHandler) {
const index = this._listeners.indexOf(eventHandler);

if (index > -1) {
this._listeners.splice(index, 1);
}
}

trigger(eventName, eventValue) {
this._listeners.forEach(listener => listener(eventName, eventValue))
}
Expand Down
6 changes: 2 additions & 4 deletions native/scripts/services/hotkeys-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class HotkeysService {
}

/**
* Get a hotkey combination by hotkey id and game id
* get a hotkey combination by hotkey id and game id
* @param hotkeyId
* @param callback
* @private
Expand All @@ -45,9 +45,7 @@ export class HotkeysService {
result.games[gameId] &&
result.games[gameId].length
) {
const hotkey = result.games[gameId].find(hotkey => {
return (hotkey.name === hotkeyId);
});
const hotkey = result.games[gameId].find(hotkey => hotkey);

if (hotkey) {
callback(hotkey.binding);
Expand Down
4 changes: 0 additions & 4 deletions native/scripts/services/running-game-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ export class RunningGameService {
}
}

/**
* Check whether a game is running
* @returns {Promise<boolean>}
*/
isGameRunning() {
return new Promise(resolve => {
// get the current running game info if any game is running
Expand Down
126 changes: 17 additions & 109 deletions native/scripts/services/windows-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export class WindowsService {
* Obtain a window object by a name as declared in the manifest.
* This is required in order to create the window before calling other APIs
* on that window
* @param {string} name
* @param name
* @returns {Promise<any>}
*/
static obtainWindow(name) {
Expand All @@ -19,30 +19,9 @@ export class WindowsService {
});
}

/**
* Obtain the current window's object. This is required in order to create
* the window before calling other APIs on that window
* @returns {Promise<any>}
*/
static getCurrentWindow() {
return new Promise((resolve, reject) => {
overwolf.windows.getCurrentWindow(result => {
if (result.success) {
resolve(result);
} else {
console.warn(
'WindowsService.getCurrentWindow(): error:',
result
);
reject(new Error(result.error));
}
});
});
}

/**
* Restore a window by name
* @param {string} name
* @param name
* @returns {Promise<any>}
*/
static async restore(name) {
Expand All @@ -62,7 +41,7 @@ export class WindowsService {

/**
* Minimize a window by name
* @param {string} name
* @param name
* @returns {Promise<any>}
*/
static async minimize(name) {
Expand All @@ -80,58 +59,24 @@ export class WindowsService {
});
}

/**
* Maximize a window by name
* @param {string} name
* @returns {Promise<any>}
*/
static async maximize(name) {
const { window } = await WindowsService.obtainWindow(name);

return new Promise((resolve, reject) => {
overwolf.windows.maximize(window.id, result => {
if (result.success) {
resolve();
} else {
console.warn('WindowsService.maximize(): error:', name, result);
reject(new Error(result.error));
}
});
});
}

/**
* Close a window
* @param {string} name
* @returns {Promise<void>}
* @param name
* @returns {Promise<any>}
*/
static async close(name) {
const state = await WindowsService.getWindowState(name);

if (state === 'closed')
return;

const { window } = await WindowsService.obtainWindow(name);

await new Promise(resolve => overwolf.windows.close(window.id, resolve));
}

/**
* Set position of a window
* @param {string} name
* @param {number} left
* @param {number} top
* @returns {Promise<any>}
*/
static async changePosition(name, left, top) {
const { window } = await WindowsService.obtainWindow(name);
if (window.stateEx === 'closed') {
return;
}

return new Promise((resolve, reject) => {
overwolf.windows.changePosition(window.id, left, top, result => {
if (result && result.success) {
resolve(result);
overwolf.windows.close(window.id, result => {
if (result.success) {
resolve();
} else {
console.warn('WindowsService.changePosition(): error:', name, result);
console.warn('WindowsService.close(): error:', name, result);
reject(new Error(result.error));
}
});
Expand All @@ -140,37 +85,17 @@ export class WindowsService {

/**
* Get state of the window
* @param {string} name
* @returns {Promise<string>}
*/
static getWindowState(name) {
return new Promise((resolve, reject) => {
overwolf.windows.getWindowState(name, result => {
if (result.success) {
resolve(result.window_state_ex);
} else {
console.warn('WindowsService.getWindowState(): error:', name, result);
reject(new Error(result.error));
}
})
});
}

/**
* Get state of the window
* @param {string} name
* @param {boolean} shouldBeTopmost
* @returns {Promise<any>}
*/
static async setTopmost(name, shouldBeTopmost) {
static async getWindowState(name) {
const { window } = await WindowsService.obtainWindow(name);

return new Promise((resolve, reject) => {
overwolf.windows.setTopmost(window.id, shouldBeTopmost, result => {
overwolf.windows.getWindowState(window.id, result => {
if (result.success) {
resolve(result);
resolve(result.window_state_ex);
} else {
console.warn('WindowsService.setTopmost(): error:', name, result);
console.warn('WindowsService.getWindowState(): error:', name, result);
reject(new Error(result.error));
}
})
Expand All @@ -185,28 +110,11 @@ export class WindowsService {
return new Promise((resolve, reject) => {
overwolf.windows.getWindowsStates(state => {
if (state.success) {
resolve(state.resultV2);
resolve(state);
} else {
reject(state);
}
})
});
}

/**
* Get a list of monitors
* @returns {Promise<any[]>}
*/
static getMonitorsList() {
return new Promise((resolve, reject) => {
overwolf.utils.getMonitorsList(result => {
if (result && result.success && result.displays) {
resolve(result.displays);
} else {
console.warn('WindowsService.getMonitorsList(): error:', result);
reject(new Error(result.error));
}
});
});
}
}
Loading

0 comments on commit 5413e0f

Please sign in to comment.