Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
ximper-shell-notification-center
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
ximper-shell-notification-center
Commits
befd6267
Commit
befd6267
authored
Feb 22, 2023
by
Erik Reider
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix buggy control center "click to exit"
parent
b1653dad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
22 deletions
+60
-22
controlCenter.vala
src/controlCenter/controlCenter.vala
+60
-22
No files found.
src/controlCenter/controlCenter.vala
View file @
befd6267
...
...
@@ -16,6 +16,10 @@ namespace SwayNotificationCenter {
const
string
STACK_NOTIFICATIONS_PAGE
=
"notifications-list"
;
const
string
STACK_PLACEHOLDER_PAGE
=
"notifications-placeholder"
;
private
Gtk
.
GestureMultiPress
blank_window_gesture
;
private
bool
blank_window_down
=
false
;
private
bool
blank_window_in
=
false
;
private
SwayncDaemon
swaync_daemon
;
private
NotiDaemon
noti_daemon
;
...
...
@@ -66,8 +70,62 @@ namespace SwayNotificationCenter {
});
this
.
unmap
.
connect
(
swaync_daemon
.
hide_blank_windows
);
this
.
button_release_event
.
connect
(
blank_window_press
);
this
.
touch_event
.
connect
(
blank_window_press
);
/*
* Handling of bank window presses (pressing outside of ControlCenter)
*/
blank_window_gesture
=
new
Gtk
.
GestureMultiPress
(
this
);
blank_window_gesture
.
set_touch_only
(
false
);
blank_window_gesture
.
set_exclusive
(
true
);
blank_window_gesture
.
set_button
(
Gdk
.
BUTTON_PRIMARY
);
blank_window_gesture
.
set_propagation_phase
(
Gtk
.
PropagationPhase
.
BUBBLE
);
blank_window_gesture
.
pressed
.
connect
((
_gesture
,
_n_press
,
x
,
y
)
=>
{
// Calculate if the clicked coords intersect the ControlCenter
Gdk
.
Rectangle
click_rectangle
=
Gdk
.
Rectangle
()
{
width
=
1
,
height
=
1
,
x
=
(
int
)
x
,
y
=
(
int
)
y
,
};
blank_window_in
=
!
box
.
intersect
(
click_rectangle
,
null
);
blank_window_down
=
true
;
});
blank_window_gesture
.
released
.
connect
((
gesture
,
_n_press
,
_x
,
_y
)
=>
{
// Emit released
if
(!
blank_window_down
)
return
;
blank_window_down
=
false
;
if
(
blank_window_in
)
{
try
{
swaync_daemon
.
set_visibility
(
false
);
}
catch
(
Error
e
)
{
stderr
.
printf
(
"ControlCenter BlankWindow Click Error: %s\n"
,
e
.
message
);
}
}
Gdk
.
EventSequence
?
sequence
=
gesture
.
get_current_sequence
();
if
(
sequence
==
null
)
{
blank_window_in
=
false
;
}
});
blank_window_gesture
.
update
.
connect
((
gesture
,
sequence
)
=>
{
Gtk
.
GestureSingle
gesture_single
=
(
Gtk
.
GestureSingle
)
gesture
;
if
(
sequence
!=
gesture_single
.
get_current_sequence
())
return
;
// Calculate if the clicked coords intersect the ControlCenter
double
x
,
y
;
gesture
.
get_point
(
sequence
,
out
x
,
out
y
);
Gdk
.
Rectangle
click_rectangle
=
Gdk
.
Rectangle
()
{
width
=
1
,
height
=
1
,
x
=
(
int
)
x
,
y
=
(
int
)
y
,
};
if
(
box
.
intersect
(
click_rectangle
,
null
))
{
blank_window_in
=
false
;
}
});
blank_window_gesture
.
cancel
.
connect
((
gesture
,
sequence
)
=>
{
blank_window_down
=
false
;
});
// Only use release for closing notifications due to Escape key
// sometimes being passed through to unfucused application
...
...
@@ -195,26 +253,6 @@ namespace SwayNotificationCenter {
}
}
private
bool
blank_window_press
(
Gdk
.
Event
event
)
{
// Calculate if the clicked coords intersect the ControlCenter
double
x
,
y
;
event
.
get_root_coords
(
out
x
,
out
y
);
Gdk
.
Rectangle
click_rectangle
=
Gdk
.
Rectangle
()
{
width
=
1
,
height
=
1
,
x
=
(
int
)
x
,
y
=
(
int
)
y
,
};
if
(
box
.
intersect
(
click_rectangle
,
null
))
return
true
;
try
{
swaync_daemon
.
set_visibility
(
false
);
}
catch
(
Error
e
)
{
stderr
.
printf
(
"ControlCenter BlankWindow Click Error: %s\n"
,
e
.
message
);
}
return
true
;
}
/** Resets the UI positions */
private
void
set_anchor
()
{
// Grabs the keyboard input until closed
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment