[Fix] Mouse events not taking into account custom window offset.
This commit is contained in:
parent
1d6b0268b5
commit
43a1bb019f
@ -98,8 +98,8 @@ int areAllies(Faction* a, Faction* b) {
|
|||||||
static Faction* faction_parse(xmlNodePtr parent) {
|
static Faction* faction_parse(xmlNodePtr parent) {
|
||||||
Faction* tmp = CALLOC_L(Faction);
|
Faction* tmp = CALLOC_L(Faction);
|
||||||
tmp->name = (char*)xmlGetProp(parent, (xmlChar*)"name");
|
tmp->name = (char*)xmlGetProp(parent, (xmlChar*)"name");
|
||||||
if(tmp->name == NULL) WARN("Faction from "FACTION_DATA"
|
if(tmp->name == NULL)
|
||||||
has invalid or no name");
|
WARN("Faction from "FACTION_DATA" has invalid or no name");
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +142,6 @@ static void alliance_parse(xmlNodePtr parent) {
|
|||||||
// Set the crap needed by faction_stack.
|
// Set the crap needed by faction_stack.
|
||||||
for(j = 0; j < (*i); j++) {
|
for(j = 0; j < (*i); j++) {
|
||||||
a->factions[j]->nallies += (*i)-1;
|
a->factions[j]->nallies += (*i)-1;
|
||||||
static void map_render(double bx, double by, double w, double h);
|
|
||||||
a->factions[j]->allies = realloc(a->factions[j]->allies,
|
a->factions[j]->allies = realloc(a->factions[j]->allies,
|
||||||
a->factions[j]->nallies*sizeof(Faction*));
|
a->factions[j]->nallies*sizeof(Faction*));
|
||||||
for(n = 0, m = 0; n < (*i); n++, m++) {
|
for(n = 0, m = 0; n < (*i); n++, m++) {
|
||||||
|
@ -912,7 +912,7 @@ static void toolkit_mouseEvent(SDL_Event* event) {
|
|||||||
if((x > wgt->x) && (x < (wgt->x + wgt->w)) &&
|
if((x > wgt->x) && (x < (wgt->x + wgt->w)) &&
|
||||||
(y > wgt->y) && (y < (wgt->y + wgt->h))) {
|
(y > wgt->y) && (y < (wgt->y + wgt->h))) {
|
||||||
if((wgt->type == WIDGET_CUST) && wgt->dat.cst.mouse)
|
if((wgt->type == WIDGET_CUST) && wgt->dat.cst.mouse)
|
||||||
(*wgt->dat.cst.mouse)(event->type, x, y);
|
(*wgt->dat.cst.mouse)(event->type, x-wgt->x, y-wgt->y);
|
||||||
else
|
else
|
||||||
switch(event->type) {
|
switch(event->type) {
|
||||||
case SDL_MOUSEMOTION:
|
case SDL_MOUSEMOTION:
|
||||||
|
Loading…
Reference in New Issue
Block a user