ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra/Deliantra/MapWidget.pm
(Generate patch)

Comparing deliantra/Deliantra/Deliantra/MapWidget.pm (file contents):
Revision 1.4 by root, Sun Feb 5 22:55:16 2006 UTC vs.
Revision 1.5 by root, Sun Feb 5 23:07:59 2006 UTC

68 $self->signal_connect_after (leave_notify_event => sub { $self->disable_tooltip; 0 }); 68 $self->signal_connect_after (leave_notify_event => sub { $self->disable_tooltip; 0 });
69 69
70 $self->signal_connect (button_press_event => sub { 70 $self->signal_connect (button_press_event => sub {
71 my ($self, $event) = @_; 71 my ($self, $event) = @_;
72 72
73 $self->disable_tooltip;
74
75 my ($x, $y) = ($event->x, $event->y); 73 my ($x, $y) = ($event->x, $event->y);
76 74
77 if ($_[1]->button == 2) { 75 if ($_[1]->button == 2 && !$self->{in_drag}) {
76 $self->disable_tooltip;
77
78 $_[0]->grab_focus; 78 $_[0]->grab_focus;
79 $self->{in_drag} = [$self->{x}, $self->{y}, $x, $y]; 79 $self->{in_drag} = [$self->{x}, $self->{y}, $x, $y];
80 return 1; 80 return 1;
81 } 81 }
82 82
103 }); 103 });
104 104
105 $self->signal_connect (button_release_event => sub { 105 $self->signal_connect (button_release_event => sub {
106 my ($self) = @_; 106 my ($self) = @_;
107 107
108 $self->enable_tooltip; 108 $self->enable_tooltip
109
110 delete $self->{in_drag}; 109 if delete $self->{in_drag};
111 110
112 1 111 0
113 }); 112 });
114 113
115 # gtk+ supports no motion compression, a major lacking feature. we have to pay for the 114 # gtk+ supports no motion compression, a major lacking feature. we have to pay for the
116 # workaround with incorrect behaviour and extra server-turnarounds. 115 # workaround with incorrect behaviour and extra server-turnarounds.
117 $self->add_events ([qw(key_press_mask key_release_mask 116 $self->add_events ([qw(key_press_mask key_release_mask
165 $self->{tip} = new Gtk2::Window "popup"; 164 $self->{tip} = new Gtk2::Window "popup";
166 $self->{tip}->can_focus (0); 165 $self->{tip}->can_focus (0);
167 $self->{tip}->set_name ("gtk-tooltips"); 166 $self->{tip}->set_name ("gtk-tooltips");
168 $self->{tip}->set_decorated (0); 167 $self->{tip}->set_decorated (0);
169 $self->{tip}->set_border_width (4); 168 $self->{tip}->set_border_width (4);
170 $self->{tip}->set_has_frame (1); 169 $self->{tip}->set_has_frame (0);
170 $self->{tip}->set_resizable (0);
171 } 171 }
172 172
173 my ($mx, $my) = $self->coord ($self->get_pointer); 173 my ($mx, $my) = $self->coord ($self->get_pointer);
174 174
175 if ($self->{tipinfo}[0] != $mx || $self->{tipinfo}[1] != $my) { 175 if ($self->{tipinfo}[0] != $mx || $self->{tipinfo}[1] != $my) {
223 223
224 # fill tooltip with info about $x, $y 224 # fill tooltip with info about $x, $y
225 my $as = $self->{map}{map}[$x][$y] || []; 225 my $as = $self->{map}{map}[$x][$y] || [];
226 for my $a (@$as) { 226 for my $a (@$as) {
227 $vbox->add (my $label = new Gtk2::Label $a->{_name}); 227 $vbox->add (my $label = new Gtk2::Label $a->{_name});
228 $label->set_alignment (0, 0.5);
228 } 229 }
229 } 230 }
230} 231}
231 232
232sub set_viewport { 233sub set_viewport {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines