Commit 71664dd3 authored by Claes Sjofors's avatar Claes Sjofors

Ge plant navigator bugfix, unselect didn't remove global selection

parent 6087b5b1
...@@ -118,10 +118,11 @@ static void nav_sel_lose_cb( GtkWidget *w, GdkEventSelection *event, ...@@ -118,10 +118,11 @@ static void nav_sel_lose_cb( GtkWidget *w, GdkEventSelection *event,
nav->selection_owner = 0; nav->selection_owner = 0;
} }
void NavGtk::set_selection_owner() void NavGtk::set_selection_owner( int set)
{ {
gboolean sts; gboolean sts;
if ( set) {
sts = gtk_selection_owner_set( selection_widget, GDK_SELECTION_PRIMARY, sts = gtk_selection_owner_set( selection_widget, GDK_SELECTION_PRIMARY,
gtk_get_current_event_time()); gtk_get_current_event_time());
if ( !sts) { if ( !sts) {
...@@ -129,6 +130,12 @@ void NavGtk::set_selection_owner() ...@@ -129,6 +130,12 @@ void NavGtk::set_selection_owner()
return; return;
} }
selection_owner = 1; selection_owner = 1;
}
else {
sts = gtk_selection_owner_set( NULL, GDK_SELECTION_PRIMARY,
gtk_get_current_event_time());
selection_owner = 0;
}
} }
void NavGtk::set_inputfocus( int focus) void NavGtk::set_inputfocus( int focus)
......
...@@ -47,7 +47,7 @@ class NavGtk : public Nav { ...@@ -47,7 +47,7 @@ class NavGtk : public Nav {
gulong sel_lose_id; gulong sel_lose_id;
void set_inputfocus( int focus); void set_inputfocus( int focus);
void set_selection_owner(); void set_selection_owner( int set);
}; };
#endif #endif
......
...@@ -147,18 +147,22 @@ static void nav_sel_lose_cb( Widget w, Atom *selection) ...@@ -147,18 +147,22 @@ static void nav_sel_lose_cb( Widget w, Atom *selection)
brow_SelectClear( nav->brow_ctx); brow_SelectClear( nav->brow_ctx);
} }
void NavMotif::set_selection_owner() void NavMotif::set_selection_owner( int set)
{ {
int sts; int sts;
if ( set) {
sts = XtOwnSelection( brow_widget, XA_PRIMARY, sts = XtOwnSelection( brow_widget, XA_PRIMARY,
XtLastTimestampProcessed(flow_Display(brow_widget)), XtLastTimestampProcessed(flow_Display(brow_widget)),
nav_sel_convert_cb, nav_sel_lose_cb , NULL); nav_sel_convert_cb, nav_sel_lose_cb , NULL);
if ( !sts) if ( !sts) {
{
brow_SelectClear( brow_ctx); brow_SelectClear( brow_ctx);
return; return;
} }
}
else {
// Todo...
}
} }
void NavMotif::set_inputfocus( int focus) void NavMotif::set_inputfocus( int focus)
......
...@@ -45,7 +45,7 @@ class NavMotif : public Nav { ...@@ -45,7 +45,7 @@ class NavMotif : public Nav {
Widget toplevel; Widget toplevel;
void set_inputfocus( int focus); void set_inputfocus( int focus);
void set_selection_owner(); void set_selection_owner( int set);
}; };
#endif #endif
......
...@@ -1549,16 +1549,18 @@ int Nav::brow_cb( FlowCtx *ctx, flow_tEvent event) ...@@ -1549,16 +1549,18 @@ int Nav::brow_cb( FlowCtx *ctx, flow_tEvent event)
if ( brow_FindSelectedObject( nav->brow_ctx, event->object.object)) { if ( brow_FindSelectedObject( nav->brow_ctx, event->object.object)) {
brow_SelectClear( nav->brow_ctx); brow_SelectClear( nav->brow_ctx);
nav->set_selection_owner( 0);
} }
else { else {
brow_SelectClear( nav->brow_ctx); brow_SelectClear( nav->brow_ctx);
brow_SetInverse( event->object.object, 1); brow_SetInverse( event->object.object, 1);
brow_SelectInsert( nav->brow_ctx, event->object.object); brow_SelectInsert( nav->brow_ctx, event->object.object);
nav->set_selection_owner( 1);
} }
nav->set_selection_owner();
break; break;
default: default:
brow_SelectClear( nav->brow_ctx); brow_SelectClear( nav->brow_ctx);
nav->set_selection_owner( 0);
} }
break; break;
} }
......
...@@ -77,7 +77,7 @@ class Nav { ...@@ -77,7 +77,7 @@ class Nav {
int show_descrip; int show_descrip;
virtual void set_inputfocus( int focus) {} virtual void set_inputfocus( int focus) {}
virtual void set_selection_owner() {} virtual void set_selection_owner( int set) {}
void zoom( double zoom_factor); void zoom( double zoom_factor);
void unzoom(); void unzoom();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment