Merge pull request #404 from atom/skip-taskbar
Add BrowserWindow.setSkipTaskbar API
This commit is contained in:
commit
4a7a417423
13 changed files with 48 additions and 0 deletions
|
@ -259,6 +259,10 @@ void Window::FlashFrame(bool flash) {
|
|||
window_->FlashFrame(flash);
|
||||
}
|
||||
|
||||
void Window::SetSkipTaskbar(bool skip) {
|
||||
window_->SetSkipTaskbar(skip);
|
||||
}
|
||||
|
||||
void Window::SetKiosk(bool kiosk) {
|
||||
window_->SetKiosk(kiosk);
|
||||
}
|
||||
|
@ -366,6 +370,7 @@ void Window::BuildPrototype(v8::Isolate* isolate,
|
|||
.SetMethod("setTitle", &Window::SetTitle)
|
||||
.SetMethod("getTitle", &Window::GetTitle)
|
||||
.SetMethod("flashFrame", &Window::FlashFrame)
|
||||
.SetMethod("setSkipTaskbar", &Window::SetSkipTaskbar)
|
||||
.SetMethod("setKiosk", &Window::SetKiosk)
|
||||
.SetMethod("isKiosk", &Window::IsKiosk)
|
||||
.SetMethod("setRepresentedFilename", &Window::SetRepresentedFilename)
|
||||
|
|
|
@ -90,6 +90,7 @@ class Window : public mate::EventEmitter,
|
|||
void SetTitle(const std::string& title);
|
||||
std::string GetTitle();
|
||||
void FlashFrame(bool flash);
|
||||
void SetSkipTaskbar(bool skip);
|
||||
void SetKiosk(bool kiosk);
|
||||
bool IsKiosk();
|
||||
void OpenDevTools();
|
||||
|
|
|
@ -176,6 +176,10 @@ void NativeWindow::InitFromOptions(base::DictionaryValue* options) {
|
|||
if (options->GetBoolean(switches::kFullscreen, &fullscreen) && fullscreen) {
|
||||
SetFullscreen(true);
|
||||
}
|
||||
bool skip;
|
||||
if (options->GetBoolean(switches::kSkipTaskbar, &skip) && skip) {
|
||||
SetSkipTaskbar(skip);
|
||||
}
|
||||
bool kiosk;
|
||||
if (options->GetBoolean(switches::kKiosk, &kiosk) && kiosk) {
|
||||
SetKiosk(kiosk);
|
||||
|
|
|
@ -127,6 +127,7 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
|||
virtual void SetTitle(const std::string& title) = 0;
|
||||
virtual std::string GetTitle() = 0;
|
||||
virtual void FlashFrame(bool flash) = 0;
|
||||
virtual void SetSkipTaskbar(bool skip) = 0;
|
||||
virtual void SetKiosk(bool kiosk) = 0;
|
||||
virtual bool IsKiosk() = 0;
|
||||
virtual void SetRepresentedFilename(const std::string& filename);
|
||||
|
|
|
@ -366,6 +366,11 @@ void NativeWindowGtk::FlashFrame(bool flash) {
|
|||
gtk_window_set_urgency_hint(window_, flash);
|
||||
}
|
||||
|
||||
void NativeWindowGtk::SetSkipTaskbar(bool skip) {
|
||||
gtk_window_set_skip_taskbar_hint(window_, skip);
|
||||
gtk_window_set_skip_pager_hint(window_, skip);
|
||||
}
|
||||
|
||||
void NativeWindowGtk::SetKiosk(bool kiosk) {
|
||||
SetFullscreen(kiosk);
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ class NativeWindowGtk : public NativeWindow,
|
|||
virtual void SetTitle(const std::string& title) OVERRIDE;
|
||||
virtual std::string GetTitle() OVERRIDE;
|
||||
virtual void FlashFrame(bool flash) OVERRIDE;
|
||||
virtual void SetSkipTaskbar(bool skip) OVERRIDE;
|
||||
virtual void SetKiosk(bool kiosk) OVERRIDE;
|
||||
virtual bool IsKiosk() OVERRIDE;
|
||||
virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
|
||||
|
|
|
@ -54,6 +54,7 @@ class NativeWindowMac : public NativeWindow {
|
|||
virtual void SetTitle(const std::string& title) OVERRIDE;
|
||||
virtual std::string GetTitle() OVERRIDE;
|
||||
virtual void FlashFrame(bool flash) OVERRIDE;
|
||||
virtual void SetSkipTaskbar(bool skip) OVERRIDE;
|
||||
virtual void SetKiosk(bool kiosk) OVERRIDE;
|
||||
virtual bool IsKiosk() OVERRIDE;
|
||||
virtual void SetRepresentedFilename(const std::string& filename) OVERRIDE;
|
||||
|
|
|
@ -416,6 +416,9 @@ void NativeWindowMac::FlashFrame(bool flash) {
|
|||
}
|
||||
}
|
||||
|
||||
void NativeWindowMac::SetSkipTaskbar(bool skip) {
|
||||
}
|
||||
|
||||
void NativeWindowMac::SetKiosk(bool kiosk) {
|
||||
if (kiosk && !is_kiosk_) {
|
||||
kiosk_options_ = [NSApp currentSystemPresentationOptions];
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include "atom/browser/native_window_win.h"
|
||||
|
||||
#include <shobjidl.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -14,6 +16,7 @@
|
|||
#include "atom/common/options_switches.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/values.h"
|
||||
#include "base/win/scoped_comptr.h"
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/render_widget_host_view.h"
|
||||
|
@ -395,6 +398,18 @@ void NativeWindowWin::FlashFrame(bool flash) {
|
|||
window_->FlashFrame(flash);
|
||||
}
|
||||
|
||||
void NativeWindowWin::SetSkipTaskbar(bool skip) {
|
||||
base::win::ScopedComPtr<ITaskbarList> taskbar;
|
||||
if (FAILED(taskbar.CreateInstance(CLSID_TaskbarList, NULL,
|
||||
CLSCTX_INPROC_SERVER)) ||
|
||||
FAILED(taskbar->HrInit()))
|
||||
return;
|
||||
if (skip)
|
||||
taskbar->DeleteTab(GetNativeWindow());
|
||||
else
|
||||
taskbar->AddTab(GetNativeWindow());
|
||||
}
|
||||
|
||||
void NativeWindowWin::SetKiosk(bool kiosk) {
|
||||
SetFullscreen(kiosk);
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@ class NativeWindowWin : public NativeWindow,
|
|||
virtual void SetTitle(const std::string& title) OVERRIDE;
|
||||
virtual std::string GetTitle() OVERRIDE;
|
||||
virtual void FlashFrame(bool flash) OVERRIDE;
|
||||
virtual void SetSkipTaskbar(bool skip) OVERRIDE;
|
||||
virtual void SetKiosk(bool kiosk) OVERRIDE;
|
||||
virtual bool IsKiosk() OVERRIDE;
|
||||
virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
|
||||
|
|
|
@ -24,6 +24,9 @@ const char kMaxHeight[] = "max-height";
|
|||
const char kResizable[] = "resizable";
|
||||
const char kFullscreen[] = "fullscreen";
|
||||
|
||||
// Whether the window should show in taskbar.
|
||||
const char kSkipTaskbar[] = "skip-taskbar";
|
||||
|
||||
// Start with the kiosk mode, see Opera's page for description:
|
||||
// http://www.opera.com/support/mastering/kiosk/
|
||||
const char kKiosk[] = "kiosk";
|
||||
|
|
|
@ -24,6 +24,7 @@ extern const char kMaxWidth[];
|
|||
extern const char kMaxHeight[];
|
||||
extern const char kResizable[];
|
||||
extern const char kFullscreen[];
|
||||
extern const char kSkipTaskbar[];
|
||||
extern const char kKiosk[];
|
||||
extern const char kAlwaysOnTop[];
|
||||
extern const char kNodeIntegration[];
|
||||
|
|
|
@ -42,6 +42,7 @@ You can also create a window without chrome by using
|
|||
* `always-on-top` Boolean - Whether the window should always stay on top of
|
||||
other windows
|
||||
* `fullscreen` Boolean - Whether the window should show in fullscreen
|
||||
* `skip-taskbar` Boolean - Do not show window in taskbar
|
||||
* `kiosk` Boolean - The kiosk mode
|
||||
* `title` String - Default window title
|
||||
* `icon` String - The path of icon file
|
||||
|
@ -353,6 +354,12 @@ Returns the title of the native window.
|
|||
|
||||
Flashes the window to attract user's attention.
|
||||
|
||||
### BrowserWindow.setSkipTaskbar(skip)
|
||||
|
||||
* `skip` Boolean
|
||||
|
||||
Makes the window do not show in taskbar.
|
||||
|
||||
### BrowserWindow.setKiosk(flag)
|
||||
|
||||
* `flag` Boolean
|
||||
|
|
Loading…
Reference in a new issue