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

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

parent 6087b5b1
...@@ -118,17 +118,24 @@ static void nav_sel_lose_cb( GtkWidget *w, GdkEventSelection *event, ...@@ -118,17 +118,24 @@ 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;
sts = gtk_selection_owner_set( selection_widget, GDK_SELECTION_PRIMARY, if ( set) {
gtk_get_current_event_time()); sts = gtk_selection_owner_set( selection_widget, GDK_SELECTION_PRIMARY,
if ( !sts) { gtk_get_current_event_time());
brow_SelectClear( brow_ctx); if ( !sts) {
return; brow_SelectClear( brow_ctx);
} 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;
sts = XtOwnSelection( brow_widget, XA_PRIMARY, if ( set) {
XtLastTimestampProcessed(flow_Display(brow_widget)), sts = XtOwnSelection( brow_widget, XA_PRIMARY,
nav_sel_convert_cb, nav_sel_lose_cb , NULL); XtLastTimestampProcessed(flow_Display(brow_widget)),
if ( !sts) nav_sel_convert_cb, nav_sel_lose_cb , NULL);
{ 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