Пример #1
0
static bool set_size_floating(int new_dimension, bool use_width) {
	swayc_t *view = get_focused_float(swayc_active_workspace());
	if (view) {
		if (use_width) {
			int current_width = view->width;
			view->desired_width = new_dimension;
			floating_view_sane_size(view);

			int new_x = view->x + (int)(((view->desired_width - current_width) / 2) * -1);
			view->width = view->desired_width;
			view->x = new_x;

			update_geometry(view);
		} else {
			int current_height = view->height;
			view->desired_height = new_dimension;
			floating_view_sane_size(view);

			int new_y = view->y + (int)(((view->desired_height - current_height) / 2) * -1);
			view->height = view->desired_height;
			view->y = new_y;

			update_geometry(view);
		}

		return true;
	}

	return false;
}
Пример #2
0
Surface::Surface():
    _sType("void")
{
    _pMaterial=0;
    _pMaterialNext=0;
    _pMaterialPrev=0;
    _x=0.;
    _y=0.;
    _z=0.;

    _dDiameter=0;
    _dDiameter2=0;

    _dInnerDiameter=0;
    _dInnerDiameter2=0;

    _bAutoDiameter=false;
    _bAutoInnerDiameter=false;

    _dConic=0.;
    _dCurvature=0.;

    _dR4=0.;
    _dR6=0.;
    _dR8=0.;
    _dR10=0.;

    _bIsPerfect=false;
    update_geometry();
}
void
OrderedTaskPoint::update_oz(const TaskProjection &projection)
{
  update_geometry();

  SampledTaskPoint::update_oz(projection);
}
static void
csm_fail_whale_dialog_size_request (GtkWidget      *widget,
                                    GtkRequisition *requisition)
{
        CsmFailWhaleDialog *fail_dialog;
        GdkRectangle   old_geometry;
        int            position_changed = FALSE;
        int            size_changed = FALSE;

        fail_dialog = CSM_FAIL_WHALE_DIALOG (widget);

        old_geometry = fail_dialog->priv->geometry;

        update_geometry (fail_dialog);

        requisition->width  = fail_dialog->priv->geometry.width;
        requisition->height = fail_dialog->priv->geometry.height;

        if (!gtk_widget_get_realized (widget)) {
                return;
        }

        if (old_geometry.width  != fail_dialog->priv->geometry.width ||
            old_geometry.height != fail_dialog->priv->geometry.height) {
                size_changed = TRUE;
        }

        if (old_geometry.x != fail_dialog->priv->geometry.x ||
            old_geometry.y != fail_dialog->priv->geometry.y) {
                position_changed = TRUE;
        }

        _window_move_resize_window (fail_dialog,
                                    position_changed, size_changed);
}
Пример #5
0
bool 
OrderedTask::Replace(const OrderedTaskPoint &new_tp, const unsigned position)
{
  if (position >= task_points.size())
    return false;

  if (task_points[position]->equals(&new_tp))
    // nothing to do
    return true;

  /* is the new_tp allowed in this context? */
  if ((position > 0 && !new_tp.predecessor_allowed()) ||
      (position + 1 < task_points.size() && !new_tp.successor_allowed()))
    return false;

  delete task_points[position];
  task_points[position] = new_tp.clone(task_behaviour, m_ordered_behaviour);

  if (position)
    set_neighbours(position - 1);

  set_neighbours(position);
  if (position + 1 < task_points.size())
    set_neighbours(position + 1);

  update_geometry();
  return true;
}
Пример #6
0
bool 
OrderedTask::Insert(const OrderedTaskPoint &new_tp, const unsigned position)
{
  if (position >= task_points.size())
    return Append(new_tp);

  if (/* is the new_tp allowed in this context? */
      (position > 0 && !new_tp.predecessor_allowed()) ||
      !new_tp.successor_allowed() ||
      /* can a tp be inserted at this position? */
      (position > 0 && !task_points[position - 1]->successor_allowed()) ||
      !task_points[position]->predecessor_allowed())
    return false;

  if (active_task_point >= position)
    active_task_point++;

  task_points.insert(task_points.begin() + position,
             new_tp.clone(task_behaviour, m_ordered_behaviour));

  if (position)
    set_neighbours(position - 1);

  set_neighbours(position);
  set_neighbours(position + 1);

  update_geometry();
  return true;
}
Пример #7
0
const ts::Double_rect& ts::graphics::Text::bounds() const
{
    if (geometry_.dirty)
    {
        update_geometry();
    }

    return geometry_.bounds;
}
Пример #8
0
const ts::graphics::Geometry& ts::graphics::Text::geometry() const
{
    if (geometry_.dirty)
    {
        update_geometry();
    }

    return geometry_.geometry;
}
void 
OrderedTaskPoint::set_neighbours(OrderedTaskPoint* _prev,
                                 OrderedTaskPoint* _next) 
{
  tp_previous = _prev;
  tp_next = _next;

  update_geometry();
}
Пример #10
0
bool 
OrderedTask::AppendOptionalStart(const OrderedTaskPoint &new_tp)
{
  optional_start_points.push_back(new_tp.clone(task_behaviour, m_ordered_behaviour));
  if (task_points.size() > 1)
    set_neighbours(0);
  update_geometry();
  return true;
}
Пример #11
0
bool
OrderedTask::Commit(const OrderedTask& that)
{
  bool modified = false;

  // change mode to that one 
  SetFactory(that.factory_mode);

  // copy across behaviour
  m_ordered_behaviour = that.m_ordered_behaviour;

  // remove if that task is smaller than this one
  while (TaskSize() > that.TaskSize()) {
    Remove(TaskSize() - 1);
    modified = true;
  }

  // ensure each task point made identical
  for (unsigned i = 0; i < that.TaskSize(); ++i) {
    if (i >= TaskSize()) {
      // that task is larger than this
      Append(*that.task_points[i]);
      modified = true;
    } else if (!task_points[i]->equals(that.task_points[i])) {
      // that task point is changed
      Replace(*that.task_points[i], i);
      modified = true;
    }
  }

  // remove if that optional start list is smaller than this one
  while (optional_start_points.size() > that.optional_start_points.size()) {
    RemoveOptionalStart(optional_start_points.size() - 1);
    modified = true;
  }

  // ensure each task point made identical
  for (unsigned i = 0; i < that.optional_start_points.size(); ++i) {
    if (i >= optional_start_points.size()) {
      // that task is larger than this
      AppendOptionalStart(*that.optional_start_points[i]);
      modified = true;
    } else if (!optional_start_points[i]->equals(that.optional_start_points[i])) {
      // that task point is changed
      ReplaceOptionalStart(*that.optional_start_points[i], i);
      modified = true;
    }
  }

  if (modified)
    update_geometry();
    // @todo also re-scan task sample state,
    // potentially resetting task

  return modified;
}
Пример #12
0
void
gst_v4l2_xoverlay_set_window_handle (GstV4l2Object * v4l2object, guintptr id)
{
  GstV4l2Xv *v4l2xv;
  XID xwindow_id = id;
  gboolean change = (v4l2object->xwindow_id != xwindow_id);

  GST_LOG_OBJECT (v4l2object->element, "Setting XID to %lx",
      (gulong) xwindow_id);

  if (!v4l2object->xv && GST_V4L2_IS_OPEN (v4l2object))
    gst_v4l2_xoverlay_open (v4l2object);

  v4l2xv = v4l2object->xv;

  if (v4l2xv)
    g_mutex_lock (v4l2xv->mutex);

  if (change) {
    if (v4l2object->xwindow_id && v4l2xv) {
      GST_DEBUG_OBJECT (v4l2object->element,
          "Deactivating old port %lx", v4l2object->xwindow_id);

      XvSelectPortNotify (v4l2xv->dpy, v4l2xv->port, 0);
      XvSelectVideoNotify (v4l2xv->dpy, v4l2object->xwindow_id, 0);
      XvStopVideo (v4l2xv->dpy, v4l2xv->port, v4l2object->xwindow_id);
    }

    v4l2object->xwindow_id = xwindow_id;
  }

  if (!v4l2xv || xwindow_id == 0) {
    if (v4l2xv)
      g_mutex_unlock (v4l2xv->mutex);
    return;
  }

  if (change) {
    GST_DEBUG_OBJECT (v4l2object->element, "Activating new port %lx",
        xwindow_id);

    /* draw */
    XvSelectPortNotify (v4l2xv->dpy, v4l2xv->port, 1);
    XvSelectVideoNotify (v4l2xv->dpy, v4l2object->xwindow_id, 1);
  }

  update_geometry (v4l2object);

  if (v4l2xv->idle_id)
    g_source_remove (v4l2xv->idle_id);
  v4l2xv->idle_id = g_idle_add (idle_refresh, v4l2object);
  g_mutex_unlock (v4l2xv->mutex);
}
Пример #13
0
double ts::graphics::Text::base_line(std::size_t character_index) const
{
    double base = line_height_;

    if (geometry_.dirty)
    {
        update_geometry();
    }
    
    auto it = std::lower_bound(geometry_.line_breaks.begin(), geometry_.line_breaks.end(), character_index);
    auto line_number = it - geometry_.line_breaks.begin();

    return base + (base * line_number);
}
Пример #14
0
bool
OrderedTask::RemoveOptionalStart(const unsigned position)
{
  if (position >= optional_start_points.size())
    return false;

  erase_optional_start(position);

  if (task_points.size()>1)
    set_neighbours(0);

  update_geometry();
  return true;
}
static void
csm_fail_whale_dialog_realize (GtkWidget *widget)
{
        if (GTK_WIDGET_CLASS (csm_fail_whale_dialog_parent_class)->realize) {
                GTK_WIDGET_CLASS (csm_fail_whale_dialog_parent_class)->realize (widget);
        }

        _window_override_user_time (CSM_FAIL_WHALE_DIALOG (widget));
        update_geometry (CSM_FAIL_WHALE_DIALOG (widget));
        _window_move_resize_window (CSM_FAIL_WHALE_DIALOG (widget), TRUE, TRUE);

        g_signal_connect (gtk_window_get_screen (GTK_WINDOW (widget)),
                          "size_changed",
                          G_CALLBACK (on_screen_size_changed),
                          widget);
}
Пример #16
0
void configurenotify(XEvent *e)
{
	dbg("configurenotify(): IN\n");
	/* update screen width/height on root geom change */
	XConfigureEvent *ev = &e->xconfigure;
	if (ev->window == root) {
		dbg("configurenotify(): \tROOT CHANGED\n");
		sw = ev->width;
		sh = ev->height;
		update_geometry();
		create_bar();
		map_bar();
		draw();
		tile_current(0);
	}
	dbg("configurenotify(): OUT\n");
}
Пример #17
0
bool 
OrderedTask::ReplaceOptionalStart(const OrderedTaskPoint &new_tp,
                                  const unsigned position)
{
  if (position >= optional_start_points.size())
    return false;

  if (optional_start_points[position]->equals(&new_tp))
    // nothing to do
    return true;

  delete optional_start_points[position];
  optional_start_points[position] = new_tp.clone(task_behaviour, m_ordered_behaviour);

  set_neighbours(0);
  update_geometry();
  return true;
}
Пример #18
0
ts::Vector2<double> ts::graphics::Text::character_position(std::size_t index) const
{
    if (geometry_.dirty)
    {
        update_geometry();
    }

    if (index >= geometry_.character_offsets.size())
    {
        return Vector2<double>();
    }

    Vector2<double> result;
    result.x = geometry_.character_offsets[index];
    result.y = base_line(index);

    return result;
}
Пример #19
0
bool
OrderedTask::Remove(const unsigned position)
{
  if (position >= task_points.size())
    return false;

  if (active_task_point > position ||
      (active_task_point > 0 && active_task_point == task_points.size() - 1))
    active_task_point--;

  erase(position);

  set_neighbours(position);
  if (position)
    set_neighbours(position - 1);

  update_geometry();
  return true;
}
Пример #20
0
void
OrderedTask::select_optional_start(unsigned pos) 
{
  assert(pos< optional_start_points.size());

  // put task start onto end
  optional_start_points.push_back(task_points[0]);
  // set task start from top optional item
  task_points[0] = optional_start_points[pos];
  // remove top optional item from list
  optional_start_points.erase(optional_start_points.begin()+pos);

  // update neighbour links
  set_neighbours(0);
  if (task_points.size()>1)
    set_neighbours(1);

  // we've changed the task, so update geometry
  update_geometry();
}
Пример #21
0
static gboolean
idle_refresh (gpointer data)
{
  GstV4l2Object *v4l2object = GST_V4L2_OBJECT (data);
  GstV4l2Xv *v4l2xv = v4l2object->xv;

  GST_LOG_OBJECT (v4l2object->element, "idle refresh");

  if (v4l2xv) {
    g_mutex_lock (v4l2xv->mutex);

    update_geometry (v4l2object);

    v4l2xv->idle_id = 0;
    g_mutex_unlock (v4l2xv->mutex);
  }

  /* once */
  return FALSE;
}
Пример #22
0
bool 
OrderedTask::Append(const OrderedTaskPoint &new_tp)
{
  if (/* is the new_tp allowed in this context? */
      (!task_points.empty() && !new_tp.predecessor_allowed()) ||
      /* can a tp be appended after the last one? */
      (task_points.size() >= 1 && !task_points[task_points.size() - 1]->successor_allowed()))
    return false;

  task_points.push_back(new_tp.clone(task_behaviour, m_ordered_behaviour));
  if (task_points.size() > 1)
    set_neighbours(task_points.size() - 2);
  else {
    // give it a value when we have one tp so it is not uninitialised
    m_location_min_last = new_tp.GetLocation();
  }

  set_neighbours(task_points.size() - 1);
  update_geometry();
  return true;
}
Пример #23
0
void Surface::set_radius_curvature(double dRadiusCurvature)
{
    _dCurvature=1./dRadiusCurvature;
    update_geometry();
}
Пример #24
0
void pointer_mode_update(void) {
	if (initial.ptr->type != C_VIEW) {
		pointer_state.mode = 0;
		return;
	}
	struct wlc_point origin;
	wlc_pointer_get_position(&origin);
	int dx = origin.x;
	int dy = origin.y;

	switch (pointer_state.mode) {
	case M_FLOATING | M_DRAGGING:
		// Update position
		switch (config->dragging_key) {
		case M_LEFT_CLICK:
			dx -= pointer_state.left.x;
			dy -= pointer_state.left.y;
			break;
		case M_RIGHT_CLICK:
			dx -= pointer_state.right.x;
			dy -= pointer_state.right.y;
			break;
		}

		if (initial.x + dx != initial.ptr->x) {
			initial.ptr->x = initial.x + dx;
		}
		if (initial.y + dy != initial.ptr->y) {
			initial.ptr->y = initial.y + dy;
		}
		update_geometry(initial.ptr);
		break;

	case M_FLOATING | M_RESIZING:
		switch (config->resizing_key) {
		case M_LEFT_CLICK:
			dx -= pointer_state.left.x;
			dy -= pointer_state.left.y;
			initial.ptr = pointer_state.left.view;
			break;
		case M_RIGHT_CLICK:
			dx -= pointer_state.right.x;
			dy -= pointer_state.right.y;
			initial.ptr = pointer_state.right.view;
			break;
		}

		if (lock.left) {
			if (initial.w + dx > min_sane_w) {
				initial.ptr->width = initial.w + dx;
			}
		} else { // lock.right
			if (initial.w - dx > min_sane_w) {
				initial.ptr->width = initial.w - dx;
				initial.ptr->x = initial.x + dx;
			}
		}
		if (lock.top) {
			if (initial.h + dy > min_sane_h) {
				initial.ptr->height = initial.h + dy;
			}
		} else { // lock.bottom
			if (initial.h - dy > min_sane_h) {
				initial.ptr->height = initial.h - dy;
				initial.ptr->y = initial.y + dy;
			}
		}
		update_geometry(initial.ptr);
		break;

	case M_TILING | M_DRAGGING:
		// swap current view under pointer with dragged view
		if (pointer_state.view && pointer_state.view->type == C_VIEW
				&& pointer_state.view != initial.ptr
				&& !pointer_state.view->is_floating) {
			// Swap them around
			swap_container(pointer_state.view, initial.ptr);
			swap_geometry(pointer_state.view, initial.ptr);
			update_geometry(pointer_state.view);
			update_geometry(initial.ptr);
			// Set focus back to initial view
			set_focused_container(initial.ptr);
		}
		break;

	case M_TILING | M_RESIZING:
		switch (config->resizing_key) {
		case M_LEFT_CLICK:
			dx -= pointer_state.left.x;
			dy -= pointer_state.left.y;
			break;
		case M_RIGHT_CLICK:
			dx -= pointer_state.right.x;
			dy -= pointer_state.right.y;
			break;
		}

		// resize if we can
		if (initial.horiz.ptr) {
			if (lock.left) {
				// Check whether its fine to resize
				if (initial.w + dx > min_sane_w && initial.horiz.w - dx > min_sane_w) {
					initial.horiz.ptr->width = initial.horiz.w - dx;
					initial.horiz.parent.ptr->width = initial.horiz.parent.w + dx;
				}
			} else { // lock.right
				if (initial.w - dx > min_sane_w && initial.horiz.w + dx > min_sane_w) {
					initial.horiz.ptr->width = initial.horiz.w + dx;
					initial.horiz.parent.ptr->width = initial.horiz.parent.w - dx;
				}
			}
			arrange_windows(initial.horiz.ptr->parent, -1, -1);
		}
		if (initial.vert.ptr) {
			if (lock.top) {
				if (initial.h + dy > min_sane_h && initial.vert.h - dy > min_sane_h) {
					initial.vert.ptr->height = initial.vert.h - dy;
					initial.vert.parent.ptr->height = initial.vert.parent.h + dy;
				}
			} else { // lock.bottom
				if (initial.h - dy > min_sane_h && initial.vert.h + dy > min_sane_h) {
					initial.vert.ptr->height = initial.vert.h + dy;
					initial.vert.parent.ptr->height = initial.vert.parent.h - dy;
				}
			}
			arrange_windows(initial.vert.ptr->parent, -1, -1);
		}
	default:
		return;
	}
}
Пример #25
0
static void update_variables(void)
{
   bool geometry_update = false;
   char key[256];
   struct retro_variable var;
   var.key = "snes9x_overclock";
   var.value = NULL;

   if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var))
   {
      int freq = atoi(var.value);
      Settings.SuperFXClockMultiplier = freq;
   }

   var.key = "snes9x_up_down_allowed";
   var.value = NULL;

   if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var))
   {
      Settings.UpAndDown = !strcmp(var.value, "disabled") ? false : true;
   }
   else
      Settings.UpAndDown = false;

   int disabled_channels=0;
   strcpy(key, "snes9x_sndchan_x");
   var.key=key;
   for (int i=0;i<8;i++)
   {
      key[strlen("snes9x_sndchan_")]='1'+i;
      var.value=NULL;
      if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && !strcmp("disabled", var.value))
         disabled_channels|=1<<i;
   }
   S9xSetSoundControl(disabled_channels^0xFF);


   int disabled_layers=0;
   strcpy(key, "snes9x_layer_x");
   for (int i=0;i<5;i++)
   {
      key[strlen("snes9x_layer_")]='1'+i;
      var.value=NULL;
      if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && !strcmp("disabled", var.value))
         disabled_layers|=1<<i;
   }
   Settings.BG_Forced=disabled_layers;

   //for some reason, Transparency seems to control both the fixed color and the windowing registers?
   var.key="snes9x_gfx_clip";
   var.value=NULL;
   Settings.DisableGraphicWindows=(environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && !strcmp("disabled", var.value));

   var.key="snes9x_gfx_transp";
   var.value=NULL;
   Settings.Transparency=!(environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && !strcmp("disabled", var.value));

   var.key="snes9x_gfx_hires";
   var.value=NULL;
   Settings.SupportHiRes=!(environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && !strcmp("disabled", var.value));

   var.key = "snes9x_overscan";

   if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
   {
     overscan_mode newval = OVERSCAN_CROP_AUTO;
     if (strcmp(var.value, "enabled") == 0)
       newval = OVERSCAN_CROP_ON;
     else if (strcmp(var.value, "disabled") == 0)
       newval = OVERSCAN_CROP_OFF;

     if (newval != crop_overscan_mode)
     {
       crop_overscan_mode = newval;
       geometry_update = true;
     }
   }

   var.key = "snes9x_aspect";

   if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
   {
      aspect_mode newval = ASPECT_RATIO_AUTO;
      if (strcmp(var.value, "ntsc") == 0)
        newval = ASPECT_RATIO_NTSC;
      else if (strcmp(var.value, "pal") == 0)
        newval = ASPECT_RATIO_PAL;
      else if (strcmp(var.value, "4:3") == 0)
        newval = ASPECT_RATIO_4_3;
      else if (strcmp(var.value, "8:7") == 0)
        newval = ASPECT_RATIO_8_7;

      if (newval != aspect_ratio_mode)
      {
        aspect_ratio_mode = newval;
        geometry_update = true;
      }
   }

   if (geometry_update)
     update_geometry();
}
Пример #26
0
void Surface::set_R10(double dR10)
{
    _dR10=dR10;
    update_geometry();
}
Пример #27
0
void Surface::set_R8(double dR8)
{
    _dR8=dR8;
    update_geometry();
}
Пример #28
0
void Surface::set_R6(double dR6)
{
    _dR6=dR6;
    update_geometry();
}
Пример #29
0
void Surface::set_R4(double dR4)
{
    _dR4=dR4;
    update_geometry();
}
Пример #30
0
void Surface::set_curvature(double dCurvature)
{
    _dCurvature=dCurvature;
    update_geometry();
}