Merge branch 'fix/clear-dock-badge-on-interaction' of https://github.com/pietervdheijden/kitty
This commit is contained in:
commit
99ff621b21
3 changed files with 15 additions and 0 deletions
|
|
@ -67,3 +67,4 @@ void get_cocoa_key_equivalent(uint32_t, int, char *key, size_t key_sz, int*);
|
|||
void set_cocoa_pending_action(CocoaPendingAction action, const char*);
|
||||
void cocoa_report_live_notifications(const char* ident);
|
||||
void cocoa_set_dock_badge(const char *label);
|
||||
void cocoa_clear_dock_badge_if_set(void);
|
||||
|
|
|
|||
|
|
@ -1341,15 +1341,23 @@ - (void)drawRect:(NSRect)dirtyRect {
|
|||
|
||||
// Dock badge {{{
|
||||
|
||||
static bool dock_badge_is_set = false;
|
||||
|
||||
void
|
||||
cocoa_set_dock_badge(const char *label) {
|
||||
@autoreleasepool {
|
||||
NSDockTile *dockTile = [NSApp dockTile];
|
||||
[dockTile setBadgeLabel:label ? @(label) : nil];
|
||||
[dockTile display];
|
||||
dock_badge_is_set = (label != NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cocoa_clear_dock_badge_if_set(void) {
|
||||
if (dock_badge_is_set) cocoa_set_dock_badge(NULL);
|
||||
}
|
||||
|
||||
// }}}
|
||||
|
||||
static PyMethodDef module_methods[] = {
|
||||
|
|
|
|||
|
|
@ -518,6 +518,9 @@ update_modifier_state_on_modifier_key_event(GLFWkeyevent *ev, int key_modifier,
|
|||
static void
|
||||
key_callback(GLFWwindow *w, GLFWkeyevent *ev) {
|
||||
if (!set_callback_window(w)) return;
|
||||
#ifdef __APPLE__
|
||||
cocoa_clear_dock_badge_if_set();
|
||||
#endif
|
||||
#ifndef __APPLE__
|
||||
bool is_left;
|
||||
int key_modifier = key_to_modifier(ev->key, &is_left);
|
||||
|
|
@ -554,6 +557,9 @@ cursor_enter_callback(GLFWwindow *w, int entered) {
|
|||
static void
|
||||
mouse_button_callback(GLFWwindow *w, int button, int action, int mods) {
|
||||
if (!set_callback_window(w)) return;
|
||||
#ifdef __APPLE__
|
||||
cocoa_clear_dock_badge_if_set();
|
||||
#endif
|
||||
monotonic_t now = monotonic();
|
||||
cursor_active_callback(now);
|
||||
mods_at_last_key_or_button_event = mods;
|
||||
|
|
|
|||
Loading…
Reference in a new issue