Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
purr-data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
brittney allen
purr-data
Commits
88955836
Commit
88955836
authored
8 years ago
by
Jonathan Wilkes
Browse files
Options
Downloads
Patches
Plain Diff
fake mouseup message on window blur, move a comment that was in the wrong place
parent
ce48a4ca
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pd/nw/pd_canvas.js
+13
-8
13 additions, 8 deletions
pd/nw/pd_canvas.js
pd/src/g_editor.c
+11
-0
11 additions, 0 deletions
pd/src/g_editor.c
with
24 additions
and
8 deletions
pd/nw/pd_canvas.js
+
13
−
8
View file @
88955836
...
@@ -106,6 +106,11 @@ function nw_window_focus_callback() {
...
@@ -106,6 +106,11 @@ function nw_window_focus_callback() {
}
}
}
}
function
nw_window_blur_callback
(
name
)
{
// Fake a mouseup event
pdgui
.
pdsend
(
name
,
"
mouseup_fake
"
);
}
// These three functions need to be inside canvas_events closure
// These three functions need to be inside canvas_events closure
function
canvas_find_whole_word
(
elem
)
{
function
canvas_find_whole_word
(
elem
)
{
canvas_events
.
match_words
(
elem
.
checked
);
canvas_events
.
match_words
(
elem
.
checked
);
...
@@ -416,18 +421,11 @@ var canvas_events = (function() {
...
@@ -416,18 +421,11 @@ var canvas_events = (function() {
},
},
text_mousedown
:
function
(
evt
)
{
text_mousedown
:
function
(
evt
)
{
if
(
textbox
()
!==
evt
.
target
&&
!
target_is_scrollbar
(
evt
))
{
if
(
textbox
()
!==
evt
.
target
&&
!
target_is_scrollbar
(
evt
))
{
// Yes: I _really_ want .innerText and NOT .textContent
// here. I want those newlines: although that isn't
// standard in Pd-Vanilla, Pd-l2ork uses and preserves
// them inside comments
utils
.
create_obj
();
utils
.
create_obj
();
//var fudi_msg = text_to_fudi(textbox().innerText);
//pdgui.pdsend(name, "createobj", fudi_msg);
//pdgui.post("formatted content is " + fudi_msg);
// send a mousedown and mouseup event to Pd to instantiate
// send a mousedown and mouseup event to Pd to instantiate
// the object
// the object
events
.
mousedown
(
evt
);
events
.
mousedown
(
evt
);
events
.
mouseup
(
evt
);
//
events.mouseup(evt);
canvas_events
.
normal
();
canvas_events
.
normal
();
}
}
evt
.
stopPropagation
();
evt
.
stopPropagation
();
...
@@ -559,6 +557,10 @@ var canvas_events = (function() {
...
@@ -559,6 +557,10 @@ var canvas_events = (function() {
},
},
utils
=
{
utils
=
{
create_obj
:
function
()
{
create_obj
:
function
()
{
// Yes: I _really_ want .innerText and NOT .textContent
// here. I want those newlines: although that isn't
// standard in Pd-Vanilla, Pd-l2ork uses and preserves
// them inside comments
var
fudi_msg
=
text_to_fudi
(
textbox
().
innerText
),
var
fudi_msg
=
text_to_fudi
(
textbox
().
innerText
),
fudi_array
=
string_to_array_of_chunks
(
fudi_msg
),
fudi_array
=
string_to_array_of_chunks
(
fudi_msg
),
i
;
i
;
...
@@ -769,6 +771,9 @@ var canvas_events = (function() {
...
@@ -769,6 +771,9 @@ var canvas_events = (function() {
gui
.
Window
.
get
().
on
(
"
focus
"
,
function
()
{
gui
.
Window
.
get
().
on
(
"
focus
"
,
function
()
{
nw_window_focus_callback
();
nw_window_focus_callback
();
});
});
gui
.
Window
.
get
().
on
(
"
blur
"
,
function
()
{
nw_window_blur_callback
(
name
);
});
// set minimum window size
// set minimum window size
gui
.
Window
.
get
().
setMinimumSize
(
150
,
100
);
gui
.
Window
.
get
().
setMinimumSize
(
150
,
100
);
...
...
This diff is collapsed.
Click to expand it.
pd/src/g_editor.c
+
11
−
0
View file @
88955836
...
@@ -4741,6 +4741,15 @@ void canvas_mouseup(t_canvas *x,
...
@@ -4741,6 +4741,15 @@ void canvas_mouseup(t_canvas *x,
(
glob_shift
+
glob_ctrl
*
2
+
glob_alt
*
4
),
0
);
(
glob_shift
+
glob_ctrl
*
2
+
glob_alt
*
4
),
0
);
}
}
/* Cheap hack to simulate mouseup at the last x/y coord. We use this in
the GUI in case the window gets a blur event before a mouseup */
void
canvas_mouseup_fake
(
t_canvas
*
x
)
{
if
(
x
->
gl_editor
&&
x
->
gl_edit
)
canvas_mouseup
(
x
,
x
->
gl_editor
->
e_xwas
,
x
->
gl_editor
->
e_ywas
,
0
);
}
/* This entire function is made superfluous in the GUI port-- we get middle-
/* This entire function is made superfluous in the GUI port-- we get middle-
click pasting for free by default. */
click pasting for free by default. */
void
canvas_mousedown_middle
(
t_canvas
*
x
,
t_floatarg
xpos
,
t_floatarg
ypos
,
void
canvas_mousedown_middle
(
t_canvas
*
x
,
t_floatarg
xpos
,
t_floatarg
ypos
,
...
@@ -7459,6 +7468,8 @@ void g_editor_setup(void)
...
@@ -7459,6 +7468,8 @@ void g_editor_setup(void)
A_FLOAT
,
A_FLOAT
,
A_FLOAT
,
A_FLOAT
,
A_NULL
);
A_FLOAT
,
A_FLOAT
,
A_FLOAT
,
A_FLOAT
,
A_NULL
);
class_addmethod
(
canvas_class
,
(
t_method
)
canvas_mouseup
,
gensym
(
"mouseup"
),
class_addmethod
(
canvas_class
,
(
t_method
)
canvas_mouseup
,
gensym
(
"mouseup"
),
A_FLOAT
,
A_FLOAT
,
A_FLOAT
,
A_NULL
);
A_FLOAT
,
A_FLOAT
,
A_FLOAT
,
A_NULL
);
class_addmethod
(
canvas_class
,
(
t_method
)
canvas_mouseup_fake
,
gensym
(
"mouseup_fake"
),
A_NULL
);
class_addmethod
(
canvas_class
,
(
t_method
)
canvas_mousedown_middle
,
gensym
(
"mouse-2"
),
class_addmethod
(
canvas_class
,
(
t_method
)
canvas_mousedown_middle
,
gensym
(
"mouse-2"
),
A_FLOAT
,
A_FLOAT
,
A_FLOAT
,
A_NULL
);
A_FLOAT
,
A_FLOAT
,
A_FLOAT
,
A_NULL
);
class_addmethod
(
canvas_class
,
(
t_method
)
canvas_key
,
gensym
(
"key"
),
class_addmethod
(
canvas_class
,
(
t_method
)
canvas_key
,
gensym
(
"key"
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment