(a) This subchapter applies to a building or portion of a building:
(1) that is:
(A) used by an agency of this state; and
(B) generally open to the public; and
(2) in which:
(A) carrying a handgun or other firearm, location-restricted knife, club, or other weapon on the premises or part of the premises would violate Chapter 46, Penal Code, or other law; or
(B) the state agency in control of the building, by sign or otherwise, prohibits handguns or other firearms, location-restricted knives, clubs, or other weapons on the premises or part of the premises.
(b) This subchapter does not apply to:
(1) a penal institution, as that term is defined by § 1.07, Penal Code; or
(2) a public primary or secondary school or institution of higher education.